<!DOCTYPE html>
<!-- saved from url=(0063)https://blog.csdn.net/weixin_53622554/article/details/129883195 -->
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <link rel="canonical" href="https://blog.csdn.net/weixin_53622554/article/details/129883195">
    
    <meta name="renderer" content="webkit">
    <meta name="force-rendering" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="report" content="{&quot;spm&quot;:&quot;1001.2101&quot;,&quot;extra&quot;:{&quot;tsab&quot;:&quot;t_1&quot;},&quot;pid&quot;:&quot;blog&quot;}">
    <meta name="referrer" content="always">
    <meta http-equiv="Cache-Control" content="no-siteapp"><link rel="alternate" media="handheld" href="https://blog.csdn.net/weixin_53622554/article/details/129883195#">
    <meta name="shenma-site-verification" content="5a59773ab8077d4a62bf469ab966a63b_1497598848">
    <meta name="applicable-device" content="pc">
    <link href="https://g.csdnimg.cn/static/logo/favicon32.ico" rel="shortcut icon" type="image/x-icon">
    <title>(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客</title>
    <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/f(4).txt"></script><script type="text/javascript" async="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/auto_dup"></script><script type="text/javascript" charset="utf-8" async="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/apiaccept"></script><script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/f(5).txt" id="google_shimpl"></script><script type="text/javascript" async="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/trackad.js.下载"></script><script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/push.js.下载"></script><script type="text/javascript" async="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/saved_resource"></script><script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/hm.js.下载"></script><script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/push.js(1).下载" id="ttzz"></script><script>
      (function(){ 
        var el = document.createElement("script"); 
        el.src = "https://s3a.pstatp.com/toutiao/push.js?1abfa13dfe74d72d41d83c86d240de427e7cac50c51ead53b2e79d40c7952a23ed7716d05b4a0f683a653eab3e214672511de2457e74e99286eb2c33f4428830"; 
        el.id = "ttzz"; 
        var s = document.getElementsByTagName("script")[0]; 
        s.parentNode.insertBefore(el, s);
      })(window)
    </script>
        <meta name="keywords" content="Java网络编程">
    <meta name="description" content="在网络通信协议下，不同计算机上运行的程序，进行的数据传输。">
        <link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/detail_enter-95840df9c6.min.css">
    <script type="application/ld+json">{"@context":"https://ziyuan.baidu.com/contexts/cambrian.jsonld","@id":"https://blog.csdn.net/weixin_53622554/article/details/129883195","appid":"1638831770136827","pubDate":"2023-03-31T16:25:23","title":"Java网络编程_Surpass余sheng军的博客-CSDN博客","upDate":"2023-03-31T17:03:13"}</script>
        <link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/skin-number-2c93789924.min.css">
    <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/jquery-1.9.1.min.js.下载" type="text/javascript"></script>
    <script type="text/javascript">
        var isCorporate = false;//注释删除enterprise
        var username =  "weixin_53622554";
        var skinImg = "white";
        var blog_address = "https://blog.csdn.net/weixin_53622554";
        var currentUserName = "u013421039";
        var isOwner = false;
        var loginUrl = "http://passport.csdn.net/account/login?from=https://blog.csdn.net/weixin_53622554/article/details/129883195";
        var blogUrl = "https://blog.csdn.net/";
        var avatar = "https://profile-avatar.csdnimg.cn/ef60164a8b2f481f98561d867bc0d251_weixin_53622554.jpg!1";
        var articleTitle = "Java网络编程";
        var articleDesc = "在网络通信协议下，不同计算机上运行的程序，进行的数据传输。";
        var articleTitles = "Java网络编程_Surpass余sheng军的博客-CSDN博客";
        var nickName = "Surpass余sheng军";
        var articleDetailUrl = "https://blog.csdn.net/weixin_53622554/article/details/129883195";
        if(window.location.host.split('.').length == 3) {
            blog_address = blogUrl + username;
        }
        var skinStatus = "White";
        var blogStaticHost = "https://csdnimg.cn/release/blogv2/"
        var mallTestStyle = "control"
    </script>
    <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/saved_resource(1)" type="text/javascript"></script>
    <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/report.js.下载" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/sandalstrap.min.css">
    <style>
        .MathJax, .MathJax_Message, .MathJax_Preview{
            display: none
        }
    </style>
    <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ds.js.下载"></script>
<link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/csdn-toolbar-default.css"><script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/csdn-notification.js.下载"></script><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/collection-box.css"><script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-login.js.下载"></script><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-tooltip.css"><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-medal.css"><script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/html2canvas.min.js.下载"></script><style></style><style type="text/css">.hljs-ln{border-collapse:collapse}            .hljs-ln td{padding:0}            .hljs-ln-n{text-align: right;padding-right: 8px;}            .hljs-ln-n:before{content:attr(data-line-number)}</style><meta http-equiv="origin-trial" content="A7CQXglZzTrThjGTBEn1rWTxHOEtkWivwzgea+NjyardrwlieSjVuyG44PkYgIPGs8Q9svD8sF3Yedn0BBBjXAkAAACFeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjk1MTY3OTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="A3vKT9yxRPjmXN3DpIiz58f5JykcWHjUo/W7hvmtjgh9jPpQgem9VbADiNovG8NkO6mRmk70Kex8/KUqAYWVWAEAAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjk1MTY3OTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="A4A26Ymj79UVY7C7JGUS4BG1s7MdcDokAQf/RP0paks+RoTYbXHxceT/5L4iKcsleFCngi75YfNRGW2+SpVv1ggAAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjk1MTY3OTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="As0hBNJ8h++fNYlkq8cTye2qDLyom8NddByiVytXGGD0YVE+2CEuTCpqXMDxdhOMILKoaiaYifwEvCRlJ/9GcQ8AAAB8eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiV2ViVmlld1hSZXF1ZXN0ZWRXaXRoRGVwcmVjYXRpb24iLCJleHBpcnkiOjE3MTk1MzI3OTksImlzU3ViZG9tYWluIjp0cnVlfQ=="><meta http-equiv="origin-trial" content="AgRYsXo24ypxC89CJanC+JgEmraCCBebKl8ZmG7Tj5oJNx0cmH0NtNRZs3NB5ubhpbX/bIt7l2zJOSyO64NGmwMAAACCeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiV2ViVmlld1hSZXF1ZXN0ZWRXaXRoRGVwcmVjYXRpb24iLCJleHBpcnkiOjE3MTk1MzI3OTksImlzU3ViZG9tYWluIjp0cnVlfQ=="><meta http-equiv="origin-trial" content="A7CQXglZzTrThjGTBEn1rWTxHOEtkWivwzgea+NjyardrwlieSjVuyG44PkYgIPGs8Q9svD8sF3Yedn0BBBjXAkAAACFeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjk1MTY3OTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="A3vKT9yxRPjmXN3DpIiz58f5JykcWHjUo/W7hvmtjgh9jPpQgem9VbADiNovG8NkO6mRmk70Kex8/KUqAYWVWAEAAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjk1MTY3OTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="A4A26Ymj79UVY7C7JGUS4BG1s7MdcDokAQf/RP0paks+RoTYbXHxceT/5L4iKcsleFCngi75YfNRGW2+SpVv1ggAAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjk1MTY3OTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="As0hBNJ8h++fNYlkq8cTye2qDLyom8NddByiVytXGGD0YVE+2CEuTCpqXMDxdhOMILKoaiaYifwEvCRlJ/9GcQ8AAAB8eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiV2ViVmlld1hSZXF1ZXN0ZWRXaXRoRGVwcmVjYXRpb24iLCJleHBpcnkiOjE3MTk1MzI3OTksImlzU3ViZG9tYWluIjp0cnVlfQ=="><meta http-equiv="origin-trial" content="AgRYsXo24ypxC89CJanC+JgEmraCCBebKl8ZmG7Tj5oJNx0cmH0NtNRZs3NB5ubhpbX/bIt7l2zJOSyO64NGmwMAAACCeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiV2ViVmlld1hSZXF1ZXN0ZWRXaXRoRGVwcmVjYXRpb24iLCJleHBpcnkiOjE3MTk1MzI3OTksImlzU3ViZG9tYWluIjp0cnVlfQ=="><style type="text/css">pre{position: relative}pre:hover .code-full-screen{display:none !important;}.code-full-screen{display: none !important;position: absolute;right: 4px;top: 3px;width: 24px !important;height: 24px !important;margin: 4px !important;}pre:hover .hljs-button{display: block}.hljs-button{display: none;position: absolute;right: 4px;top: 4px;font-size: 12px;color: #ffffff;background-color: #9999AA;padding: 2px 8px;margin: 8px;border-radius: 4px;cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.05);}.hljs-button:after{content: attr(data-title)}code .hljs-button{margin: 2px 8px;}</style><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-accusation.css"><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-ordertip.css"><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/order-payment.css"><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/side-toolbar.css"><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/csdn-footer.css"><style>hcfy-result.__hcfy__result__loaded__.__hcfy__result__both__{border: 1px dotted}</style><link rel="stylesheet" type="text/css" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-login.css"><link rel="preload" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/f(6).txt" as="script"><script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/f(6).txt"></script><style type="text/css">.MathJax_Hover_Frame {border-radius: .25em; -webkit-border-radius: .25em; -moz-border-radius: .25em; -khtml-border-radius: .25em; box-shadow: 0px 0px 15px #83A; -webkit-box-shadow: 0px 0px 15px #83A; -moz-box-shadow: 0px 0px 15px #83A; -khtml-box-shadow: 0px 0px 15px #83A; border: 1px solid #A6D ! important; display: inline-block; position: absolute}
.MathJax_Menu_Button .MathJax_Hover_Arrow {position: absolute; cursor: pointer; display: inline-block; border: 2px solid #AAA; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px; font-family: 'Courier New',Courier; font-size: 9px; color: #F0F0F0}
.MathJax_Menu_Button .MathJax_Hover_Arrow span {display: block; background-color: #AAA; border: 1px solid; border-radius: 3px; line-height: 0; padding: 4px}
.MathJax_Hover_Arrow:hover {color: white!important; border: 2px solid #CCC!important}
.MathJax_Hover_Arrow:hover span {background-color: #CCC!important}
</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_About.MathJax_MousePost {outline: none}
.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 2px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_MenuItem {padding: 2px 2em; background: transparent}
.MathJax_MenuArrow {position: absolute; right: .5em; padding-top: .25em; color: #666666; font-size: .75em}
.MathJax_MenuActive .MathJax_MenuArrow {color: white}
.MathJax_MenuArrow.RTL {left: .5em; right: auto}
.MathJax_MenuCheck {position: absolute; left: .7em}
.MathJax_MenuCheck.RTL {right: .7em; left: auto}
.MathJax_MenuRadioCheck {position: absolute; left: 1em}
.MathJax_MenuRadioCheck.RTL {right: 1em; left: auto}
.MathJax_MenuLabel {padding: 2px 2em 4px 1.33em; font-style: italic}
.MathJax_MenuRule {border-top: 1px solid #CCCCCC; margin: 4px 1px 0px}
.MathJax_MenuDisabled {color: GrayText}
.MathJax_MenuActive {background-color: Highlight; color: HighlightText}
.MathJax_MenuDisabled:focus, .MathJax_MenuLabel:focus {background-color: #E8E8E8}
.MathJax_ContextMenu:focus {outline: none}
.MathJax_ContextMenu .MathJax_MenuItem:focus {outline: none}
#MathJax_AboutClose {top: .2em; right: .2em}
.MathJax_Menu .MathJax_MenuClose {top: -10px; left: -10px}
.MathJax_MenuClose {position: absolute; cursor: pointer; display: inline-block; border: 2px solid #AAA; border-radius: 18px; -webkit-border-radius: 18px; -moz-border-radius: 18px; -khtml-border-radius: 18px; font-family: 'Courier New',Courier; font-size: 24px; color: #F0F0F0}
.MathJax_MenuClose span {display: block; background-color: #AAA; border: 1.5px solid; border-radius: 18px; -webkit-border-radius: 18px; -moz-border-radius: 18px; -khtml-border-radius: 18px; line-height: 0; padding: 8px 0 6px}
.MathJax_MenuClose:hover {color: white!important; border: 2px solid #CCC!important}
.MathJax_MenuClose:hover span {background-color: #CCC!important}
.MathJax_MenuClose:hover:focus {outline: none}
</style><style type="text/css">.MathJax_Preview .MJXf-math {color: inherit!important}
</style><style type="text/css">.MJX_Assistive_MathML {position: absolute!important; top: 0; left: 0; clip: rect(1px, 1px, 1px, 1px); padding: 1px 0 0 0!important; border: 0!important; height: 1px!important; width: 1px!important; overflow: hidden!important; display: block!important; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none}
.MJX_Assistive_MathML.MJX_Assistive_MathML_Block {width: 100%!important}
</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
#MathJax_ZoomFrame {position: relative; display: inline-block; height: 0; width: 0}
#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
</style><style type="text/css">.MathJax_Preview {color: #888}
#MathJax_Message {position: fixed; left: 1em; bottom: 1.5em; background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap}
#MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px}
.MathJax_Error {color: #CC0000; font-style: italic}
</style><style type="text/css">.MJXp-script {font-size: .8em}
.MJXp-right {-webkit-transform-origin: right; -moz-transform-origin: right; -ms-transform-origin: right; -o-transform-origin: right; transform-origin: right}
.MJXp-bold {font-weight: bold}
.MJXp-italic {font-style: italic}
.MJXp-scr {font-family: MathJax_Script,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-frak {font-family: MathJax_Fraktur,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-sf {font-family: MathJax_SansSerif,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-cal {font-family: MathJax_Caligraphic,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-mono {font-family: MathJax_Typewriter,'Times New Roman',Times,STIXGeneral,serif}
.MJXp-largeop {font-size: 150%}
.MJXp-largeop.MJXp-int {vertical-align: -.2em}
.MJXp-math {display: inline-block; line-height: 1.2; text-indent: 0; font-family: 'Times New Roman',Times,STIXGeneral,serif; white-space: nowrap; border-collapse: collapse}
.MJXp-display {display: block; text-align: center; margin: 1em 0}
.MJXp-math span {display: inline-block}
.MJXp-box {display: block!important; text-align: center}
.MJXp-box:after {content: " "}
.MJXp-rule {display: block!important; margin-top: .1em}
.MJXp-char {display: block!important}
.MJXp-mo {margin: 0 .15em}
.MJXp-mfrac {margin: 0 .125em; vertical-align: .25em}
.MJXp-denom {display: inline-table!important; width: 100%}
.MJXp-denom > * {display: table-row!important}
.MJXp-surd {vertical-align: top}
.MJXp-surd > * {display: block!important}
.MJXp-script-box > *  {display: table!important; height: 50%}
.MJXp-script-box > * > * {display: table-cell!important; vertical-align: top}
.MJXp-script-box > *:last-child > * {vertical-align: bottom}
.MJXp-script-box > * > * > * {display: block!important}
.MJXp-mphantom {visibility: hidden}
.MJXp-munderover {display: inline-table!important}
.MJXp-over {display: inline-block!important; text-align: center}
.MJXp-over > * {display: block!important}
.MJXp-munderover > * {display: table-row!important}
.MJXp-mtable {vertical-align: .25em; margin: 0 .125em}
.MJXp-mtable > * {display: inline-table!important; vertical-align: middle}
.MJXp-mtr {display: table-row!important}
.MJXp-mtd {display: table-cell!important; text-align: center; padding: .5em 0 0 .5em}
.MJXp-mtr > .MJXp-mtd:first-child {padding-left: 0}
.MJXp-mtr:first-child > .MJXp-mtd {padding-top: 0}
.MJXp-mlabeledtr {display: table-row!important}
.MJXp-mlabeledtr > .MJXp-mtd:first-child {padding-left: 0}
.MJXp-mlabeledtr:first-child > .MJXp-mtd {padding-top: 0}
.MJXp-merror {background-color: #FFFF88; color: #CC0000; border: 1px solid #CC0000; padding: 1px 3px; font-style: normal; font-size: 90%}
.MJXp-scale0 {-webkit-transform: scaleX(.0); -moz-transform: scaleX(.0); -ms-transform: scaleX(.0); -o-transform: scaleX(.0); transform: scaleX(.0)}
.MJXp-scale1 {-webkit-transform: scaleX(.1); -moz-transform: scaleX(.1); -ms-transform: scaleX(.1); -o-transform: scaleX(.1); transform: scaleX(.1)}
.MJXp-scale2 {-webkit-transform: scaleX(.2); -moz-transform: scaleX(.2); -ms-transform: scaleX(.2); -o-transform: scaleX(.2); transform: scaleX(.2)}
.MJXp-scale3 {-webkit-transform: scaleX(.3); -moz-transform: scaleX(.3); -ms-transform: scaleX(.3); -o-transform: scaleX(.3); transform: scaleX(.3)}
.MJXp-scale4 {-webkit-transform: scaleX(.4); -moz-transform: scaleX(.4); -ms-transform: scaleX(.4); -o-transform: scaleX(.4); transform: scaleX(.4)}
.MJXp-scale5 {-webkit-transform: scaleX(.5); -moz-transform: scaleX(.5); -ms-transform: scaleX(.5); -o-transform: scaleX(.5); transform: scaleX(.5)}
.MJXp-scale6 {-webkit-transform: scaleX(.6); -moz-transform: scaleX(.6); -ms-transform: scaleX(.6); -o-transform: scaleX(.6); transform: scaleX(.6)}
.MJXp-scale7 {-webkit-transform: scaleX(.7); -moz-transform: scaleX(.7); -ms-transform: scaleX(.7); -o-transform: scaleX(.7); transform: scaleX(.7)}
.MJXp-scale8 {-webkit-transform: scaleX(.8); -moz-transform: scaleX(.8); -ms-transform: scaleX(.8); -o-transform: scaleX(.8); transform: scaleX(.8)}
.MJXp-scale9 {-webkit-transform: scaleX(.9); -moz-transform: scaleX(.9); -ms-transform: scaleX(.9); -o-transform: scaleX(.9); transform: scaleX(.9)}
.MathJax_PHTML .noError {vertical-align: ; font-size: 90%; text-align: left; color: black; padding: 1px 3px; border: 1px solid}
</style><script async="" src="https://fundingchoicesmessages.google.com/i/ca-pub-1076724771190722?ers=2"></script></head>
  <body class="nodata " style=""><div id="MathJax_Message" style="display: none;"></div><div id="csdn-toolbar" style="position: fixed; min-width: 100%; width: max-content; top: 0px; left: 0px; z-index: 1993;">
                    <div class="toolbar-inside exp3">
                      <div class="toolbar-container">
                        <div class="toolbar-container-left">
                          <div class="toolbar-logo toolbar-subMenu-box csdn-toolbar-fl"><a data-report-click="{&quot;spm&quot;:&quot;3001.4476&quot;}" data-report-query="spm=3001.4476" href="https://www.csdn.net/"><img title="CSDN首页" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20201124032511.png"></a>
                    </div>
                          <ul class="toolbar-menus csdn-toolbar-fl"><li class="active " title="阅读深度、前沿文章">
                                <a data-report-click="{&quot;mod&quot;:&quot;popu_336&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/&quot;,&quot;spm&quot;:&quot;3001.4477&quot;}" data-report-query="spm=3001.4477" href="https://blog.csdn.net/">
                                  博客
                                  
                                  
                                </a>
                                
                                
                              </li><li class="" title="高价值源码课程分享">
                                <a data-report-click="{&quot;mod&quot;:&quot;popu_336&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/&quot;,&quot;spm&quot;:&quot;3001.6907&quot;}" data-report-query="spm=3001.6907" href="https://download.csdn.net/">
                                  下载
                                  
                                  
                                </a>
                                
                                
                              </li><li class="" title="系统学习·问答·比赛">
                                <a data-report-click="{&quot;mod&quot;:&quot;popu_336&quot;,&quot;dest&quot;:&quot;https://edu.csdn.net/&quot;,&quot;spm&quot;:&quot;3001.4482&quot;}" data-report-query="spm=3001.4482" href="https://edu.csdn.net/">
                                  学习
                                  
                                  
                                </a>
                                
                                
                              </li><li class="" title="找到志同道合的伙伴">
                                <a data-report-click="{&quot;mod&quot;:&quot;popu_336&quot;,&quot;dest&quot;:&quot;https://bbs.csdn.net/&quot;,&quot;spm&quot;:&quot;3001.6068&quot;}" data-report-query="spm=3001.6068" href="https://bbs.csdn.net/">
                                  社区
                                  
                                  
                                </a>
                                
                                
                              </li>false<li class="" title="开源代码托管">
                                <a data-report-click="{&quot;mod&quot;:&quot;&quot;,&quot;dest&quot;:&quot;https://gitcode.net?utm_source=csdn_toolbar&quot;,&quot;spm&quot;:&quot;3001.6768&quot;}" data-report-query="spm=3001.6768" href="https://gitcode.net/?utm_source=csdn_toolbar">
                                  GitCode
                                  
                                  
                                </a>
                                
                                
                              </li><li class="" title="让你的灵感的立即落地">
                                <a data-report-click="{&quot;mod&quot;:&quot;popu_336&quot;,&quot;dest&quot;:&quot;https://inscode.csdn.net/gpu?utm_source=260232576&quot;,&quot;spm&quot;:&quot;3001.8290&quot;}" data-report-query="spm=3001.8290" href="https://inscode.csdn.net/gpu?utm_source=260232576">
                                  InsCode
                                  <img style="vertical-align: middle; width: 34px;margin-top: -3px;" "="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20230607014810.png">
                                  
                                </a>
                                
                                
                              </li></ul>
                        </div>
                        <div class="toolbar-container-middle">
                        <div class="toolbar-search onlySearch"><div class="toolbar-search-container">
                    <span class="icon-fire"></span>
                    <input id="toolbar-search-input" maxlength="2000" autocomplete="off" type="text" value="" placeholder="servlet" style="text-indent: 32px;"><div class="gradient"></div>
                    <button id="toolbar-search-button"><i></i><span>搜索</span></button>
                    <input type="password" autocomplete="new-password" readonly="" disabled="true" style="display: none; position:absolute;left:-9999999px;width:0;height:0;">
                  </div></div></div>
                        <div class="toolbar-container-right">
                          <div class="toolbar-btns onlyUser"><div class="toolbar-btn toolbar-btn-login toolbar-btn-login-new csdn-toolbar-fl toolbar-subMenu-box">
          <a class="hasAvatar" data-report-click="{&quot;spm&quot;: &quot;3001.5343&quot;}" data-report-query="spm=3001.5343" href="https://blog.csdn.net/u013421039"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/2_u013421039"></a>
          <div id="csdn-toolbar-profile" class="csdn-toolbar-plugin">
            <div class="csdn-profile-top">
              <a class="csdn-profile-avatar" data-report-click="{&quot;spm&quot;: &quot;3001.5343&quot;}" data-report-query="spm=3001.5343" href="https://blog.csdn.net/u013421039"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/0_u013421039"></a>
              <p class="csdn-profile-nickName">--</p>
              <a data-report-click="{&quot;spm&quot;: &quot;3001.5344&quot;}" data-report-query="spm=3001.5344" href="https://mall.csdn.net/vip" class="csdn-profile-no-vip"></a>
            </div>
            <div class="csdn-profile-mid">
              <a data-report-click="{&quot;spm&quot;: &quot;3001.5347&quot;}" data-report-query="spm=3001.5347" href="https://blog.csdn.net/u013421039?type=sub&amp;subType=fans"><i class="csdn-profile-fansCount">--</i>粉丝</a>
              <a data-report-click="{&quot;spm&quot;: &quot;3001.5348&quot;}" data-report-query="spm=3001.5348" href="https://blog.csdn.net/u013421039?type=sub"><i class="csdn-profile-followCount">--</i>关注</a>
              <a data-report-click="{&quot;spm&quot;: &quot;3001.5349&quot;}" data-report-query="spm=3001.5349" href="https://blog.csdn.net/u013421039"><i class="csdn-profile-likeCount">--</i>获赞</a>
            </div>
            <div class="csdn-profile-bottom">
              <ul class="csdn-border-bottom">
                <li class=""><a href="https://i.csdn.net/#/user-center/profile" data-report-click="{&quot;dest&quot;:&quot;https://i.csdn.net/#/user-center/profile&quot;,&quot;spm&quot;:&quot;3001.5111&quot;}" data-report-query="spm=3001.5111"><i class="csdn-profile-icon csdn-profile-icon-person"></i>个人中心</a></li><li class=""><a href="https://mp.csdn.net/mp_blog/manage/article?spm=1011.2124.3001.5298" data-report-click="{&quot;dest&quot;:&quot;https://mp.csdn.net/mp_blog/manage/article?spm=1011.2124.3001.5298&quot;,&quot;spm&quot;:&quot;3001.5448&quot;}" data-report-query="spm=3001.5448"><i class="csdn-profile-icon csdn-profile-icon-pages"></i>内容管理</a></li><li class=""><a href="https://edu.csdn.net/?utm_source=edu_txxl_mh" data-report-click="{&quot;dest&quot;:&quot;https://edu.csdn.net?utm_source=edu_txxl_mh&quot;,&quot;spm&quot;:&quot;3001.5350&quot;}" data-report-query="spm=3001.5350"><i class="csdn-profile-icon csdn-profile-icon-study"></i>我的学习</a></li><li class=""><a href="https://mall.csdn.net/myorder" data-report-click="{&quot;dest&quot;:&quot;https://mall.csdn.net/myorder&quot;,&quot;spm&quot;:&quot;3001.5137&quot;}" data-report-query="spm=3001.5137"><i class="csdn-profile-icon csdn-profile-icon-order"></i>我的订单</a></li><li class=""><a href="https://i.csdn.net/#/wallet/index" data-report-click="{&quot;dest&quot;:&quot;https://i.csdn.net/#/wallet/index&quot;,&quot;spm&quot;:&quot;3001.5136&quot;}" data-report-query="spm=3001.5136"><i class="csdn-profile-icon csdn-profile-icon-wallet"></i>我的钱包</a></li><li class=""><a href="https://dev-portal.csdn.net/welcome?utm_source=toolbar_user_profile" data-report-click="{&quot;dest&quot;:&quot;https://dev-portal.csdn.net/welcome?utm_source=toolbar_user_profile&quot;,&quot;spm&quot;:&quot;3001.7345&quot;}" data-report-query="spm=3001.7345"><i class="csdn-profile-icon csdn-profile-icon-API"></i>我的云服务</a></li><li class="pb-8 csdn-border-bottom"><a href="https://ac.csdn.net/user/myCert.html" data-report-click="{&quot;dest&quot;:&quot;https://ac.csdn.net/user/myCert.html&quot;,&quot;spm&quot;:&quot;3001.7346&quot;}" data-report-query="spm=3001.7346"><i class="csdn-profile-icon csdn-profile-icon-ac"></i>我的认证</a></li><li class="pt-8 pb-8 csdn-border-bottom"><a href="https://i.csdn.net/#/uc/reward" data-report-click="{&quot;dest&quot;:&quot;https://i.csdn.net/#/uc/reward&quot;,&quot;spm&quot;:&quot;3001.5351&quot;}" data-report-query="spm=3001.5351"><i class="csdn-profile-icon csdn-profile-icon-draw"></i>签到抽奖</a></li><li class="pt-8 csdn-profile-logout"><a href="javascript:;" data-report-click="{&quot;spm&quot;:&quot;3001.5139&quot;}" data-report-query="spm=3001.5139"><i class="csdn-profile-icon csdn-profile-icon-logout"></i>退出</a></li>
              </ul>
            </div>
          </div></div>
          <div class="toolbar-btn toolbar-btn-vip csdn-toolbar-fl">
            <a data-report-click="{&quot;mod&quot;:&quot;popu_336&quot;,&quot;dest&quot;:&quot;https://mall.csdn.net/vip&quot;,&quot;spm&quot;:&quot;3001.4496&quot;}" data-report-query="spm=3001.4496" href="https://mall.csdn.net/vip">
              会员中心 <img style="position: relative; vertical-align: middle; width: 14px; top: -2px; left: 0px;;display:inline-block" "="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20210918025138.gif">
            </a>
          <div id="csdn-plugin-vip" style="background:url(https://img-home.csdnimg.cn/images/20210826055049.png) no-repeat center center; background-size: cover;" }="">
                        <div class="csdn-plugin-vip-header">
                            会员特权
                        </div>
                        <div class="csdn-plugin-vip-body">
                            <a href="https://mall.csdn.net/vip?utm_source=vip_hyzx_hytbcj#draw"><i class="csdn-plugin-vip-icon" style="background:url(https://img-home.csdnimg.cn/images/20220215105130.png);background-size: contain;"></i><br>抽豪礼</a><a href="https://mall.csdn.net/vip?utm_source=vip_pc_hybjt"><i class="csdn-plugin-vip-icon" style="background:url(https://img-home.csdnimg.cn/images/20210826043936.png);background-size: contain;"></i><br>领券中心</a><a href="https://mall.csdn.net/vip?utm_source=vip_hyzx_fc_xsjz"><i class="csdn-plugin-vip-icon" style="background:url(https://img-home.csdnimg.cn/images/20211115095959.png);background-size: contain;"></i><br>赠3个月</a><a href="https://vip.csdn.net/welfarecenter?utm_source=vip_hyzx_hytblq#discount_center"><i class="csdn-plugin-vip-icon" style="background:url(https://img-home.csdnimg.cn/images/20210826043937.png);background-size: contain;"></i><br>会员购</a>
                        </div>
                        <div class="csdn-plugin-vip-footer">                
                            <a data-report-click="{&quot;spm&quot;: &quot;3001.6440&quot;}" data-report-query="spm=3001.6440" class="csdn-plugin-vip-footer-link" href="https://mall.csdn.net/vip">
                              领取限时优惠券，最高可减80元<i></i>
                            </a>
                            <a data-report-click="{&quot;spm&quot;: &quot;3001.6439&quot;}" data-report-query="spm=3001.6439" class="csdn-plugin-vip-footer-btn" href="https://mall.csdn.net/vip">
                              领券开通
                            </a>
                        </div>
                    </div></div>
          <div class="toolbar-btn toolbar-btn-msg csdn-toolbar-fl">
              <div class="toolbar-subMenu-box">
                <a data-report-click="{&quot;spm&quot;:&quot;3001.4508&quot;}" data-report-query="spm=3001.4508" id="toolbar-remind" href="https://i.csdn.net/#/msg/index"><span class="pos-rel">消息<i class="toolbar-msg-count"></i></span></a>
              <div class="toolbar-subMenu">
                          <a data-type="comment" href="https://i.csdn.net/#/msg/index"><span class="pos-rel">评论和@<i></i></span></a>
                          <a data-type="attention" href="https://i.csdn.net/#/msg/attention"><span class="pos-rel">新增粉丝<i></i></span></a>         
                          <a data-type="like" href="https://i.csdn.net/#/msg/like"><span class="pos-rel">赞和收藏<i></i></span></a>
                          <a data-type="chat" href="https://im.csdn.net/im/main.html"><span class="pos-rel">私信<i></i></span></a>
                          <a data-type="notice" href="https://i.csdn.net/#/msg/notice"><span class="pos-rel">系统通知<i></i></span></a>
                          <a href="https://i.csdn.net/#/msg/setting">消息设置</a>
                     </div></div>
              <div class="toolbar-msg-box"></div>
            </div>
          <div class="toolbar-btn toolbar-btn-collect csdn-toolbar-fl">
            <a data-report-click="{&quot;spm&quot;:&quot;3001.7480&quot;}" data-report-query="spm=3001.7480" href="https://i.csdn.net/#/user-center/history">历史</a>
          </div>
          <div class="toolbar-btn toolbar-btn-mp csdn-toolbar-fl">
            <a title="创作中心" data-report-click="{&quot;dest&quot;:&quot;https://mp.csdn.net/&quot;,&quot;spm&quot;:&quot;3001.8539&quot;}" data-report-query="spm=3001.8539" href="https://mp.csdn.net/">
              创作中心
            </a>
          </div>
          <div class="toolbar-btn toolbar-btn-write toolbar-btn-write-new csdn-toolbar-fl toolbar-subMenu-box"><a class="has-img" data-report-click="{&quot;spm&quot;:&quot;3001.7765&quot;}" data-report-query="spm=3001.7765" href="https://mp.csdn.net/edit">
                      <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20230406105129.png">
                    </a>
        <div id="csdn-toolbar-write" class="csdn-toolbar-plugin" style="opacity: 1; display: none;">
          <div class="csdn-toolbar-plugin-triangle"></div>
          <ul class="csdn-toolbar-write-box">
            <li class="csdn-toolbar-write-box-blog">
              <a href="https://mp.csdn.net/edit" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.5352&quot;}" data-report-query="spm=3001.5352">
                <i class="csdn-toolbar-write-icon"></i>
                <span>写文章</span>
              </a>
            </li>
            <li class="csdn-toolbar-write-box-inscode">
              <a href="https://inscode.csdn.net/?utm_source=109355915" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.9241&quot;}" data-report-query="spm=3001.9241">
                <i class="csdn-toolbar-write-icon"></i>
                <span>写代码</span>
              </a>
            </li>
            <li class="csdn-toolbar-write-box-blink">
              <a href="https://blink.csdn.net/" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.5353&quot;}" data-report-query="spm=3001.5353">
                <i class="csdn-toolbar-write-icon"></i>
                <span>发动态</span>
              </a>
            </li>
            <li class="csdn-toolbar-write-box-ask">
              <a href="https://ask.csdn.net/new?utm_source=p_toolbar" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.5354&quot;}" data-report-query="spm=3001.5354">
                <i class="csdn-toolbar-write-icon"></i>
                <span>提问题</span>
              </a>
            </li>
            <li class="csdn-toolbar-write-box-upload">
              <a href="https://mp.csdn.net/mp_download/creation/uploadResources" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.5355&quot;}" data-report-query="spm=3001.5355">
                <i class="csdn-toolbar-write-icon"></i>
                <span>传资源</span>
              </a>
            </li>
            <li class="csdn-toolbar-write-box-code">
              <a href="https://gitcode.net/explore" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.5356&quot;}" data-report-query="spm=3001.5356">
                <i class="csdn-toolbar-write-icon"></i>
                <span>建项目</span>
              </a>
            </li>
          </ul>
        
        <div class="csdn-toolbar-write-activity">
          <div class="csdn-toolbar-write-activity-head"><span>创作活动</span><a href="https://mp.csdn.net/mp_blog/manage/creative?spm=1011.2124.3001.5311" target="_blank" data-report-click="{&quot;spm&quot;:&quot;3001.5358&quot;}" data-report-query="spm=3001.5358">更多<i></i></a></div>
          <ul>
          <li>
            <a href="https://activity.csdn.net/creatActivity?id=10470" target="_blank">#2023 博客之星评选已开启--成为城市领跑者</a>
          </li>
        
          <li>
            <a href="https://activity.csdn.net/creatActivity?id=10467" target="_blank">#如何对待工作中的失误？</a>
          </li>
        
          <li>
            <a href="https://activity.csdn.net/creatActivity?id=10465" target="_blank">#毕业在即，给高考生选择IT相关专业的小tips</a>
          </li>
        
          <li>
            <a href="https://activity.csdn.net/creatActivity?id=10461" target="_blank">#“2023我在开源峰会”特别征文</a>
          </li>
        </ul>
          <div class="toolbar-write-activity-more">
          </div>
        </div>
      </div>
      </div>
        </div>
                        </div>
                      </div>
                    </div>
                  </div>
        <script>
            var toolbarSearchExt = '{"landingWord":[],"queryWord":"","tag":["servlet"],"title":"Java网络编程"}';
        </script>
    <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/csdn-toolbar.js.下载" type="text/javascript"></script>
    <script>
    (function(){
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        }
        else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
    </script>

    <link rel="stylesheet" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/blog_code-01256533b5.min.css">
    <link rel="stylesheet" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/chart-3456820cac.css">
    <link rel="stylesheet" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/swiper.css">
    <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/swiper.js.下载" async=""></script>
    <script>
      var articleId = 129883195;
      var commentscount = 0;
      var curentUrl = "https://blog.csdn.net/weixin_53622554/article/details/129883195";
      var myUrl = "https://my.csdn.net/";
        var highlight = ["servlet","java","网络编程"];//高亮数组
        var isRecommendModule = true;
          var isBaiduPre = true;
          var baiduCount = 2;
          var setBaiduJsCount = 10;
      var share_card_url = "https://app-blog.csdn.net/share?article_id=129883195&username=weixin_53622554"
      var articleType = 1;
      var baiduKey = "";
      var userNewReport = true;
      var copyPopSwitch = true;
      var needInsertBaidu = true;
      var recommendRegularDomainArr = ["blog.csdn.net/.+/article/details/","download.csdn.net/download/","edu.csdn.net/course/detail/","ask.csdn.net/questions/","bbs.csdn.net/topics/","www.csdn.net/gather_.+/"]
      var codeStyle = "atom-one-light";
      var baiduSearchType = "";
      var sharData = "{\"hot\":[{\"id\":1,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/a5f4260710904e538002a6ab337939b3.png\"},{\"id\":2,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/188b37199a2c4b74b1d9ffc39e0d52de.png\"},{\"id\":3,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/14ded358b631444581edd98a256bc5af.png\"},{\"id\":4,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/1470f23a770444d986ad551b9c33c5be.png\"},{\"id\":5,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/c329f5181dc74f6c9bd28c982bb9f91d.png\"},{\"id\":6,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/ccd8a3305e81460f9c505c95b432a65f.png\"},{\"id\":7,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/bc89d8283389440d97fc4d30e30f45e1.png\"},{\"id\":8,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/452d485b4a654f5592390550d2445edf.png\"},{\"id\":9,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/f8b9939db2ed474a8f43a643015fc8b7.png\"},{\"id\":10,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/6de8864187ab4ed3b1db0856369c36ff.png\"},{\"id\":11,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/673cc3470ff74072acba958dc0c46e2d.png\"},{\"id\":12,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/930c119760ac4491804db80f9c6d4e3f.png\"},{\"id\":13,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/15e6befb05a24233bc2b65e96aa8d972.png\"},{\"id\":14,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/2075fd6822184b95a41e214de4daec13.png\"},{\"id\":15,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/859b1552db244eb6891a809263a5c657.png\"},{\"id\":16,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/0be2f920f1f74290a98921974a9613fd.png\"},{\"id\":17,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/2e97e00b43f14afab494ea55ef3f4a6e.png\"},{\"id\":18,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/ff4ab252f46e444686f5135d6ebbfec0.png\"},{\"id\":19,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/ae029bbe99564e79911657912d36524f.png\"},{\"id\":20,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/b3ece39963de440388728e9e7b9bf427.png\"},{\"id\":21,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/6f14651a99ba486e926d63b6fa692997.png\"},{\"id\":22,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/83ceddf050084875a341e32dcceca721.png\"},{\"id\":23,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/b90368b8fd5d4c6c8c79a707d877cf7c.png\"},{\"id\":24,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/aeffae14ecf14e079b2616528c9a393b.png\"},{\"id\":25,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/c5a06b5a13d44d16bed868fc3384897a.png\"},{\"id\":26,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/08b697658b844b318cea3b119e9541ef.png\"},{\"id\":27,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/68ccb0b8d09346ac961d2b5c1a8c77bf.png\"},{\"id\":28,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/a2227a247e37418cbe0ea972ba6a859b.png\"},{\"id\":29,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/3a42825fede748f9993e5bb844ad350d.png\"},{\"id\":30,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/8882abc1dd484224b636966ea38555c3.png\"},{\"id\":31,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/4f6a5f636a3e444d83cf8cc06d87a159.png\"},{\"id\":32,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/1953ef79c56b4407b78d7181bdff11c3.png\"},{\"id\":33,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/c04a2a4f772948ed85b5b0380ed36287.png\"},{\"id\":34,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/5b4fecd05091405ea04d8c0f53e9f2c7.png\"},{\"id\":35,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/b89f576d700344e280d6ceb2a66c2420.png\"},{\"id\":36,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/1c65780e11804bbd9971ebadb3d78bcf.png\"},{\"id\":37,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/d590db2055f345db9706eb68a7ec151a.png\"},{\"id\":38,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/fe602f80700b4f6fb3c4a9e4c135510e.png\"},{\"id\":39,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/39ff2fcd31e04feba301a071976a0ba7.png\"},{\"id\":40,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/f9b61b3d113f436b828631837f89fb39.png\"},{\"id\":41,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/df1aca5f610c4ad48cd16da88c9c8499.png\"},{\"id\":42,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/d7acf73a1e6b41399a77a85040e10961.png\"},{\"id\":43,\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/b7f1b63542524b97962ff649ab4e7e23.png\"}],\"vip\":[{\"id\":1,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101150.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101154.png\"},{\"id\":2,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101204.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101208.png\"},{\"id\":3,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101211.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101215.png\"},{\"id\":4,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101218.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101220.png\"},{\"id\":5,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101223.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220920101226.png\"},{\"id\":6,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220922100635.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220922100639.png\"},{\"id\":7,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220922100642.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220922100644.png\"},{\"id\":8,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220922100647.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220922100649.png\"},{\"id\":9,\"vipUrl\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220922100652.png\",\"url\":\"https:\\/\\/img-home.csdnimg.cn\\/images\\/20220922100655.png\"},{\"id\":10,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/55de67481fde4b04b97ad78f11fe369a.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/bb2418fb537e4d78b10d8765ccd810c5.png\"},{\"id\":11,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/579c713394584d128104ef1044023954.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/f420d9fbcf5548079d31b5e809b6d6cd.png\"},{\"id\":12,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/75b7f3155ba642f5a4cc16b7baf44122.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/a9030f5877be401f8b340b80b0d91e64.png\"},{\"id\":13,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/0903d33cafa54934be3780aa54ae958d.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/2cd8c8929f5a42fca5da2a0aeb456203.png\"},{\"id\":14,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/949fd7c22884439fbfc3c0e9c3b8dee7.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/dafbea9bd9eb4f3b962b48dc41657f89.png\"},{\"id\":15,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/4119cfddd71d4e6a8a27a18dbb74d90e.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/c56310c8b6384d9e85388e4e342ce508.png\"},{\"id\":16,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/121575274da142bcbbbbc2e8243dd411.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/5013993de06542f881018bb9abe2edf7.png\"},{\"id\":17,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/4d97aa6dd4fe4f09a6bef5bdf8a6abcd.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/76f23877b6ad4066ad45ce8e31b4b977.png\"},{\"id\":18,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/fdb619daf21b4c829de63b9ebc78859d.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/a1abe5d27a5441f599adfe662f510243.png\"},{\"id\":19,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/676b7707bb11410f8f56bc0ed2b2345c.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/7ac5b467fbf24e1d8c2de3f3332c4f54.png\"},{\"id\":20,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/0becb8cc227e4723b765bdd69a20fd4a.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/fdec85b26091486b9a89d0b8d45c3749.png\"},{\"id\":21,\"vipUrl\":\"https:\\/\\/img-blog.csdnimg.cn\\/1a6c06235ad44941b38c54cbc25a370c.png\",\"url\":\"https:\\/\\/img-blog.csdnimg.cn\\/410a06cda2d44b0c84578f88275caf70.png\"}],\"map\":{\"hot\":\"热门\",\"vip\":\"VIP\"}}";
      
      var canRead = true;
      var blogMoveHomeArticle = false;
      var showPcWindowAd = false;
      var showHeadWord = true;
      var showSearchText = "";
      var linkPage = true;
      var articleSource = 1;
      var articleReport = '{"spm":"1001.2101","extra":{"tsab":"t_1"},"pid":"blog"}';
      var isShowToQuestion = false;
        var baiduSearchChannel = 'pc_relevant'
        var baiduSearchIdentification = '.235^v38^pc_relevant_anti_t3'
        var distRequestId = '1686562696428_39618'
        var initRewardObject = {
          giver: "u013421039",
          anchor: "weixin_53622554",
          articleId: "129883195",
          sign: "1d980a1eecb80351eaf83aa1a6760c9c",
        }
        var isLikeStatus = false;
        var isUnLikeStatus = false;
        var studyLearnWord = "";
        var isCurrentUserVip = false;
        var contentViewsHeight = 0;
        var contentViewsCount = 0;
        var contentViewsCountLimit = 5;
        var isShowConcision = true
      var isCookieConcision = false
      var isHasDirectoryModel = false
      var isShowSideModel = false
      var isShowDirectoryModel = true
      function getCookieConcision(sName){
        var allCookie = document.cookie.split("; ");
        for (var i=0; i < allCookie.length; i++){
          var aCrumb = allCookie[i].split("=");
          if (sName == aCrumb[0])
            return aCrumb[1];
        }
        return null;
      }
      if (getCookieConcision('blog_details_concision') && getCookieConcision('blog_details_concision') == 0){
        isCookieConcision = true
        isShowSideModel = true
        isShowDirectoryModel = false
      }
    </script>
        <div class="main_father clearfix d-flex justify-content-center" style="height: auto !important;">
          <div class="container clearfix" id="mainBox">
          <script>
          if (!isCookieConcision) {
            $('.main_father').removeClass('mainfather-concision')
            $('.main_father .container').removeClass('container-concision')
          }
          </script>
          <main>
<script type="text/javascript">
    var resourceId =  "";
    function getQueryString(name) {   
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象  
      var r = window.location.search.substr(1).match(reg);  //匹配目标参数
      if( r != null ) return decodeURIComponent( r[2] ); return '';   
    }
    function stripscript(s){ 
      var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？%]") 
      var rs = ""; 
      for (var i = 0; i < s.length; i++) { 
        rs = rs+s.substr(i, 1).replace(pattern, ''); 
      } 
      return rs;
    }
    var blogHotWords = stripscript(getQueryString('utm_term')).length > 1 ? stripscript(getQueryString('utm_term')) : ''
</script>
<div class="blog-content-box">
    <div class="article-header-box">
        <div class="article-header">
            <div class="article-title-box">
                <h1 class="title-article" id="articleContentId">Java网络编程</h1>
            </div>
            <div class="article-info-box">
                <div class="article-bar-top">
                    <img class="article-type-img" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/original.png" alt="">
                    <div class="bar-content">
                      <a class="follow-nickName " href="https://blog.csdn.net/weixin_53622554" target="_blank" rel="noopener" title="Surpass余sheng军">Surpass余sheng军</a>
                    <img class="article-time-img article-heard-img" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newUpTime2.png" alt="">
                    <span class="time">已于&nbsp;2023-04-11 15:55:12&nbsp;修改</span>
                    <img class="article-read-img article-heard-img" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/articleReadEyes2.png" alt="">
                    <span class="read-count">284</span>
                    <a id="blog_detail_zk_collection" class="un-collection" data-report-click="{&quot;mod&quot;:&quot;popu_823&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4232&quot;,&quot;ab&quot;:&quot;new&quot;}">
                        <img class="article-collect-img article-heard-img un-collect-status isdefault" style="display:inline-block" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/tobarCollect2.png" alt="">
                        <img class="article-collect-img article-heard-img collect-status isactive" style="display:none" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/tobarCollectionActive2.png" alt="">
                        <span class="name">收藏</span>
                        <span class="get-collection" style="color: rgb(153, 154, 170);">
                        </span>
                    </a>
                    </div>
                </div>
                <div class="blog-tags-box">
                    <div class="tags-box artic-tag-box">
                            <span class="label">分类专栏：</span>
                                <a class="tag-link" href="https://blog.csdn.net/weixin_53622554/category_12195583.html" target="_blank" rel="noopener">Java</a>
                            <span class="label">文章标签：</span>
                                <a data-report-click="{&quot;mod&quot;:&quot;popu_626&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4223&quot;,&quot;strategy&quot;:&quot;servlet&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;extra&quot;:&quot;{\&quot;searchword\&quot;:\&quot;servlet\&quot;}&quot;}" class="tag-link" href="https://so.csdn.net/so/search/s.do?q=servlet&amp;t=all&amp;o=vip&amp;s=&amp;l=&amp;f=&amp;viparticle=" target="_blank" rel="noopener">servlet</a>
                    </div>
                </div>
                <div class="up-time" style="left: 185.51px; display: none;"><span>于&nbsp;2023-03-31 17:03:13&nbsp;首次发布</span></div>
                <div class="slide-content-box">
                    <div class="article-copyright">
                        <div class="creativecommons">
                            版权声明：本文为博主原创文章，遵循<a href="http://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener"> CC 4.0 BY </a>版权协议，转载请附上原文出处链接和本声明。
                        </div>
                        <div class="article-source-link">
                            本文链接：<a href="https://blog.csdn.net/weixin_53622554/article/details/129883195" target="_blank">https://blog.csdn.net/weixin_53622554/article/details/129883195</a>
                        </div>
                    </div>
                </div>
                
                <div class="operating">
                    <a class="href-article-edit slide-toggle">版权</a>
                </div>
            </div>
        </div>
    </div>
    
        <div id="blogColumnPayAdvert">
            <div class="column-group">
                <div class="column-group-item column-group0 column-group-item-one">
                    <div class="item-l">
                        <a class="item-target" href="https://blog.csdn.net/weixin_53622554/category_12195583.html" target="_blank" title="Java" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.6332&quot;}">
                            <img class="item-target" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20201014180756927.png" alt="">
                            <span class="title item-target">
                                <span>
                                <span class="tit">Java</span>
                                    <span class="dec">专栏收录该内容</span>
                                </span>
                            </span>
                        </a>
                    </div>
                    <div class="item-m">
                        <span>56 篇文章</span>
                        <span>2 订阅</span>
                    </div>
                    <div class="item-r">
                            <a class="item-target article-column-bt articleColumnFreeBt" data-id="12195583">订阅专栏</a>
                    </div>
                </div>
            </div>
        </div>
    <article class="baidu_pl">
        <div id="article_content" class="article_content clearfix">
        <link rel="stylesheet" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/kdoc_html_views-1a98987dfd.css">
        <link rel="stylesheet" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ck_htmledit_views-25cebea3f9.css">
                <div id="content_views" class="htmledit_views">
                    <h1><a name="t0"></a>&nbsp;一. 网络编程概述</h1> 
<h3><a name="t1"></a><strong>计算机网络</strong></h3> 
<ul><li>是指将地理位置不同的具有独立功能的多台计算机及其外部设备，通过通信线路连接起来，在网络操作系统，网络管理软件及网络通信协议的管理和协调下，实现资源共享和信息传递的计算机系统</li></ul> 
<h3><a name="t2"></a>什么是网络编程？</h3> 
<ul><li><span style="background-color:#f9eda6;">在网络通信协议下，不同计算机上运行的程序，进行的数据传输。</span></li></ul> 
<h3><a name="t3"></a>网络编程的应用场景：</h3> 
<ul><li>即时通信、网游对战、金融证券、国际贸易、邮件等等...</li><li>不管是什么场景，都是<span style="color:#fe2c24;"><span style="background-color:#f9eda6;">计算机</span></span><span style="background-color:#f9eda6;">跟</span><span style="color:#fe2c24;"><span style="background-color:#f9eda6;">计算机</span></span><span style="background-color:#f9eda6;">之间通过网络进行数据传输。</span></li><li>Java中可以使用<span style="color:#fe2c24;">java.net</span>包下的技术轻松开发出常见的网络应用程序。</li></ul> 
<h3><a name="t4"></a>&nbsp;常见的软件架构<img alt="" height="576" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/628299e6ff2145049b00d8ffa70f69ec.png" width="1125"></h3> 
<ul><li><span style="background-color:#f9eda6;">客户端或者浏览器，它们两个仅仅是负责把数据展示出来，展示给用户去看，在项目当中，真正的核心业务逻辑，其实都是在后面的服务器当中。</span></li></ul> 
<h3><a name="t5"></a><img alt="" height="671" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/42c3722ac0b947ffa243f0252923ef37.png" width="1200"><span style="color:#fe2c24;">&nbsp;1.&nbsp;B/S架构：</span></h3> 
<blockquote> 
 <ul><li><strong><span style="color:#fe2c24;">B/S：Browser/Server&nbsp; 浏览器/服务器：通过浏览器访问服务器</span></strong></li><li><strong><span style="color:#fe2c24;">B/S架构适合移动互联网应用，可以再任何地方随时访问的系统。</span></strong></li><li><span style="background-color:#f9eda6;">B/S架构只需要一个浏览器，用户通过不同的网址，客户访问不同的服务器。</span></li><li><span style="background-color:#f9eda6;">所有通过浏览器去访问的，其实都是BS架构</span></li><li><span style="background-color:#f9eda6;">B/S架构不需要开发客户端。</span></li><li><span style="background-color:#f9eda6;">BS架构更新功能是不需要用户操作的，直接在服务器修改就可以了</span>，<span style="background-color:#ffd900;">用户唯一要做的就是刷新一下浏览器</span>，仅此而已。所以BS架构的特点主要突出一个，方便。</li><li><span style="background-color:#f9eda6;">缺点：如果应用过大，用户体验将收到影响</span>，<span style="background-color:#f9eda6;">因为服务器需要把图片、背景音乐等资源通过网络再传输给浏览器</span>，比如说网页游戏的画质就会非常的差劲，背景音乐也没有那么精美。</li><li><img alt="" height="379" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/75f6dcb667d34f3a91a07551932dfe4b.png" width="557"></li></ul> 
</blockquote> 
<h3><a name="t6"></a><span style="color:#fe2c24;"><strong>&nbsp;2. C/S架构：</strong></span></h3> 
<blockquote> 
 <ul><li><span style="color:#fe2c24;"><strong>C/S：Client/Server&nbsp; 客户端/服务器：通过客户端访问服务器</strong></span></li><li><span style="color:#fe2c24;"><strong>C/S架构需要开发客户端</strong></span></li><li><span style="background-color:#f9eda6;">C/S架构在用户本地需要下载并安装客户端程序，在远程有一个服务器端程序。</span></li><li><span style="background-color:#f9eda6;">所有需要我们下载安装包并进行安装的，都是C/S架构</span>，比如LOL，王者荣耀等...</li><li><span style="background-color:#f9eda6;">画面越精美，它的安装包越大</span>，<span style="background-color:#f9eda6;">因为C/S架构当中的安装包里面包含的就是</span>游戏<span style="background-color:#f9eda6;">所用到的</span>图片、音乐等<span style="background-color:#f9eda6;">资源，那么这些资源在安装的时候就已经在本地了</span>，<span style="background-color:#f9eda6;">服务器就不需要把</span>图片、音乐等<span style="background-color:#f9eda6;">资源通过网络再传输给客户端了，服务器只需要客户端，现在该显示哪张图片了。</span></li><li><span style="background-color:#f9eda6;">C/S架构的软件因为已经事先下载好了所有的资源，所以可以把画面，音乐做的非常的精美，用户的体验非常的好。</span></li><li><span style="background-color:#f9eda6;">C/S架构既要开发客户端又要开发服务端，所以对于公司来讲C/S架构的开发、安装、部署、维护都会非常的麻烦，特别是服务器一更新，客户端也要跟着一起更新。</span></li><li><span style="background-color:#f9eda6;">C/S架构适合定制专业化的办公类软件，如：IDEA、网游</span></li><li><img alt="" height="619" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ec2c5e5987db43afb135388779a1294b.png" width="858"></li></ul> 
</blockquote> 
<p><img alt="" height="511" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/84d5c1fba16040e1a45667870a7f9547.png" width="1200"></p> 
<h1><a name="t7"></a>二. 网络编程三要素</h1> 
<ul><li><span style="background-color:#f9eda6;">所谓三要素，是指两台电脑需要传输数据，需要知道哪些东西才能传输，特别是想要给一堆电脑中的一台去发送数据</span>。</li><li><span style="background-color:#f9eda6;">IP：确定对方设备(电脑等)在互联网上的地址，而这个地址是唯一的，叫做IP，IP地址是唯一的！IP地址可以唯一标识网络中的设备。要想让网络中的计算机能够互相通信，必须为每台计算机指定一个标识号，通过这个标识号来只指定要接收数据的计算机和识别发送的计算机，而IP地址就是这个标识号，也就是设备的标识号。</span></li><li><span style="background-color:#f9eda6;">端口号：网络的通信，本质上是两个应用程序的通信。每台计算机都有很多的应用程序，端口号是应用程序在设备中唯一的标识，确定对方设备上接收数据的软件，一个端口号只能被一个软件绑定使用。端口号可以唯一标识设备中的应用程序，也就是应用程序的标识。</span></li><li><span style="background-color:#f9eda6;">协议：确定网络传输的协议！协议就是数据在网络中传输的规则，常见的协议有UDP协议、TCP协议、http、https、ftp。通过计算机网络可以使多台计算机实现连接，位于同一个网络中的计算机在进行连接和通信时需要遵守一定的规则，在计算机网络中，这些连接和通信的规则被称为网络通信协议，它对数据的传输格式、传输速率、传输步骤等做了统一规定，通信双方必须同时遵守才能完成数据交换。</span></li></ul> 
<p><img alt="" height="479" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/d23749c68ec843529f72a2491a6ac280.png" width="1112"></p> 
<h1><a name="t8"></a><span style="color:#fe2c24;">1. IP</span></h1> 
<h2><a name="t9"></a><img alt="" height="469" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/bf37ef76b2544ac5bbfb4e6577a24e66.png" width="624"></h2> 
<h3><a name="t10"></a><span style="color:#fe2c24;">&nbsp;IPv4</span></h3> 
<ul><li><span style="background-color:#f9eda6;">目前的主流方案，是给每个连接在网络上的恶主机分配一个32bit地址。按照TCP/IP规定，IP地址用二进制来表示，每个IP地址长32bit，也就是4个字节。为了方便使用，IP地址经常被写成十进制的形式。</span></li><li><span style="background-color:#f9eda6;">点分十进制表示法：一个字节作为一段数据，用点隔开。一个字节是8位，8位也就是一个字节的取值范围是0-255，总共256种信息。它会把8个bit分成一组，那么总共是4组，每一组再转成十进制，中间用点进行区分，每一组它的取值范围是0-255。</span></li><li><span style="background-color:#f9eda6;">点表示用点分隔，十进制表示最终转成十进制的表示方式。</span></li><li><span style="background-color:#f9eda6;">IPv4最多只能有2^32次方个IP，目前已经用完了</span></li></ul> 
<h3><a name="t11"></a><img alt="" height="621" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/b690128b5c01410d8d4a4f3a736e136b.png" width="1186"></h3> 
<h3><a name="t12"></a><span style="background-color:#f9eda6;">&nbsp;&nbsp;IPv4差不多能表示43亿个IP，为了解决IP不够用的问题，所以才出现了IPv6，这样就解决了网络地址资源数量不够的问题</span></h3> 
<h3><a name="t13"></a><span style="color:#fe2c24;">IPv6</span></h3> 
<ul><li><span style="color:#0d0016;"><span style="background-color:#f9eda6;">IPv6它可以给地球上的每一粒沙子都定一个IP</span></span></li><li><span style="color:#0d0016;"><span style="background-color:#f9eda6;">IPv6最多有2^128次方个IP</span></span></li><li><span style="color:#0d0016;"><span style="background-color:#f9eda6;">IPv6还正在渐渐普及。</span></span></li></ul> 
<p><img alt="" height="580" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/6ef1344dfc3541ed8cfb3b14c0312c01.png" width="1200"></p> 
<ul><li><span style="background-color:#f9eda6;">&nbsp;冒分十六进制表示法：把上面的每一组转换成16进制，再用冒号去分隔。</span><img alt="" height="701" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a16f8abf35c64b65a1c367c3a43194f0.png" width="1200"></li></ul> 
<h3><a name="t14"></a><span style="color:#fe2c24;">&nbsp;IPv4的一些小细节</span></h3> 
<blockquote> 
 <h3><a name="t15"></a><span style="color:#fe2c24;">IPv4的地址分类形式</span></h3> 
 <ul><li><span style="background-color:#f9eda6;">公网地址(万维网使用)和私有地址(局域网使用)，即公网IP和私有IP，私有IP也叫做局域网IP。</span></li><li><span style="background-color:#f9eda6;">192.168.开头的就是私有地址 / 局域网IP，范围为192.168.0.0--192.168.255.255，专门为组织机构内部使用，以此节省IP。现在就是用局域网IP去节省IP的使用。</span></li><li><span style="background-color:#f9eda6;">我们知道IPv4是不够的，那么如何解决IPv4不够的问题呢？</span></li><li><span style="background-color:#f9eda6;">利用局域网IP解决IP不够的问题。</span></li><li><span style="background-color:#f9eda6;">例如下图，网吧里面是有很多很多电脑的，但不是每一台电脑在连接外网的时候就有一个公网的IP，它们往往是共享同一个公网IP，再由路由器给每一台电脑分配局域网IP，这样就可以实现节约IP的效果，这就是利用局域网节省IP的原理。</span></li></ul> 
</blockquote> 
<p><img alt="" height="690" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a6cc057d08d44e7aa20a7c0430ea2b2e.png" width="1134"></p> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">&nbsp;127.0.0.1永远表示本机的IP，本机IP，也就是自己电脑的IP。</span></li><li><img alt="" height="316" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e784eaed0dd74a29898bf40a6a88f69f.png" width="1200"></li><li><span style="background-color:#f9eda6;">假设192.168.1.100是我电脑的IP，那么这个IP跟127.0.0.1是不一样的！</span></li><li><span style="background-color:#f9eda6;">如下图，假设局域网当中有6台电脑，那么这些IP都是由路由器所分配的，如果要往192.168.1.100去发送数据，此时这个数据是先发到路由器，路由器再找到你当前的IP，这样子才能实现数据的发送。</span></li><li><span style="background-color:#f9eda6;">但是，每一个路由器给自己的电脑分配的IP是不一样的，所以会有这样一个情况，当你换了一个地方上网，局域网IP有可能不一样。</span></li><li><img alt="" height="372" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/152f003155d6441f9a674de9de10812e.png" width="1056"></li><li></li><li><span style="background-color:#f9eda6;">如下图，如果要往127.0.0.1去发送数据，那么此时它是不经过路由器的，你的数据在经过网卡的时候，网卡发现你要往127.0.0.1去发送数据，那此时，它就直接把这个数据给你自己发过来了，不管你是在哪个地方上网，永远都是这样的，这就是两者的区别。</span></li><li><img alt="" height="347" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/5ae5a3d8268e4907845e17418e206a75.png" width="1027"></li><li></li><li>建议：<span style="background-color:#f9eda6;">以后自己写练习的时候，如果是自己给自己发数据，那么就写127.0.0.1，这就可以了。</span></li></ul> 
</blockquote> 
<h3><a name="t16"></a><span style="color:#fe2c24;">常见的CMD命令</span></h3> 
<blockquote> 
 <ul><li><strong><span style="color:#fe2c24;">ipconfig：查看本机IP地址</span></strong></li><li><img alt="" height="900" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/097848c9b40441efab814d4297aa843c.png" width="1151"></li><li><strong><span style="color:#fe2c24;">ping + IP / 网址：检查网络是否联通</span></strong></li><li><strong><span style="color:#fe2c24;">ping这个命令除了能检查局域网里面的网络是否畅通，它还可以检查你的电脑跟外网是否畅通。</span></strong></li><li><strong>网址的底层逻辑其实也是IP，如下图，我们可以看到百度服务器的IP：220.181.38.149</strong></li><li><strong><span style="color:#fe2c24;">在ping的后面可以跟随IP，也可以跟随网址</span></strong></li><li><img alt="" height="314" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/85a109814ed54e039f055dcd527b8887.png" width="785"></li></ul> 
</blockquote> 
<h3><a name="t17"></a><span style="color:#fe2c24;">InetAddress类的使用：该类表示Internet协议 / IP地址。</span></h3> 
<blockquote> 
 <ul><li>I<span style="background-color:#f9eda6;">netAddress：在Java当中用来表示IP的类，InetAddress的对象就表示的IP的对象。</span></li><li><span style="background-color:#f9eda6;">获取InetAddress的对象，表示IP的对象，IP又表示电脑，所以说这个类的对象可以看作是一台电脑的对象，它表示的就是网络中的某一台电脑。</span></li><li><span style="background-color:#f9eda6;">但是会有一个问题，IP有两种，一个是IPv4，一个是IPv6，到底创建的是哪个对象呢？它有两个子类，一个是Inet4Address，一个是Inet6Address，所以我们在获取这个类的对象的时候，它在底层会有一个操作，它会先判断你当前系统用的是四版本的还是六版本的，然后根据你当前系统的版本返回对应的对象。</span></li><li><span style="background-color:#f9eda6;">InetAddress这个类对外没有提供构造方法，所以不能直接new，我们需要通过它的静态方法getByName去获取对象，这个方法的底层它就会做一个判断，判断你当前电脑的系统用的是IPv4还是IPv6，判断完了之后它会创建对应子类的对象给你进行一个返回。</span></li><li> <p><span style="background-color:#f9eda6;">InetAddress的一个实例由一个IP地址和可能的相应主机名组成</span>（取决于它是用主机名构造还是已经完成了反向主机名解析）。</p> </li><li> <p><span style="background-color:#f9eda6;">主机名就是你给自己电脑起的名字，如果你没起，它会有默认的</span>。如果要<a href="https://so.csdn.net/so/search?q=%E4%BF%AE%E6%94%B9%E4%B8%BB%E6%9C%BA%E5%90%8D&amp;spm=1001.2101.3001.7020" target="_blank" class="hl hl-1" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.7020&quot;,&quot;dest&quot;:&quot;https://so.csdn.net/so/search?q=%E4%BF%AE%E6%94%B9%E4%B8%BB%E6%9C%BA%E5%90%8D&amp;spm=1001.2101.3001.7020&quot;,&quot;extra&quot;:&quot;{\&quot;searchword\&quot;:\&quot;修改主机名\&quot;}&quot;}" data-tit="修改主机名" data-pretit="修改主机名">修改主机名</a>，修改完记得重启，建议：<span style="background-color:#f9eda6;">主机名不要用中文</span>。</p> </li><li> <p>注意:<span style="background-color:#f9eda6;">如果说你的电脑因为网络原因或者是局域网当中就没有这台电脑，那么此时是获取不到它的主机名的，如果获取不到它的主机名那么是以IP的形式进行返回的。</span></p> </li></ul> 
</blockquote> 
<pre data-index="0" class="" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d1_InetAddress;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.InetAddress;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.UnknownHostException;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">InetAddressDemo1</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> UnknownHostException {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">             static InetAddress getByName(String host) 确定主机名称的IP地址。</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">                    主机名称可以是机器名称，也可以是IP地址</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">             String getHostName()       获取此IP地址的主机名</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">             String getHostAddress()   返回文本显示中的IP地址字符串</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.获取InetAddress的对象,表示IP的对象  </span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">//    IP又表示电脑,所以说这个类的对象可以看作是一台电脑的对象，它表示的就是网络中的某一台电脑</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">InetAddress</span>  <span class="hljs-variable">address</span> <span class="hljs-operator">=</span> InetAddress.getByName(<span class="hljs-string">"192.168.1.100"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(address); <span class="hljs-comment">// /192.168.1.100</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">InetAddress</span> <span class="hljs-variable">address1</span> <span class="hljs-operator">=</span> InetAddress.getByName(<span class="hljs-string">"ROG"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(address1); <span class="hljs-comment">// ROG/192.168.56.1</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(address == address1); <span class="hljs-comment">// false</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.获取电脑的主机名</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 注意:如果说你的电脑因为网络原因或者是局域网当中就没有这台电脑，那么此时是获取不到它的主机名的</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//      如果获取不到它的主机名那么是以IP的形式进行返回的</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">String</span> <span class="hljs-variable">name</span> <span class="hljs-operator">=</span> address.getHostName();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(name); <span class="hljs-comment">// 192.168.1.100</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">String</span> <span class="hljs-variable">name1</span> <span class="hljs-operator">=</span> address1.getHostName();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(name1); <span class="hljs-comment">// ROG</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.获取电脑的IP</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">String</span>  <span class="hljs-variable">ip</span> <span class="hljs-operator">=</span> address1.getHostAddress();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(ip); <span class="hljs-comment">// 192.168.56.1</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<pre data-index="1" class="" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d1_InetAddress;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.InetAddress;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">    目标：InetAddress类概述（了解）</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         一个该类的对象就代表一个IP地址对象。</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">    InetAddress类成员方法：</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         static InetAddress getLocalHost()</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            * 获得本地主机IP地址对象。</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         static InetAddress getByName(String host)</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            * 根据IP地址字符串或主机名获得对应的IP地址对象。</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         String getHostName()</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            * 获得主机名。</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         String getHostAddress()</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            * 获得IP地址字符串。</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">InetAddressDemo01</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.获取本机地址对象。</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">InetAddress</span> <span class="hljs-variable">ip1</span> <span class="hljs-operator">=</span> InetAddress.getLocalHost();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(ip1.getHostName()); <span class="hljs-comment">// ROG</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(ip1.getHostAddress()); <span class="hljs-comment">// 192.168.56.1</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.获取域名ip对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">InetAddress</span> <span class="hljs-variable">ip2</span> <span class="hljs-operator">=</span> InetAddress.getByName(<span class="hljs-string">"www.baidu.com"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(ip2.getHostName()); <span class="hljs-comment">// www.baidu.com</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(ip2.getHostAddress()); <span class="hljs-comment">// www.baidu.com</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.获取公网IP对象。</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">InetAddress</span> <span class="hljs-variable">ip3</span> <span class="hljs-operator">=</span> InetAddress.getByName(<span class="hljs-string">"112.80.248.76"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(ip3.getHostName()); <span class="hljs-comment">// 112.80.248.76</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(ip3.getHostAddress()); <span class="hljs-comment">// 112.80.248.76</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.判断是否能通： ping  5s之前测试是否可通</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(ip3.isReachable(<span class="hljs-number">5000</span>)); <span class="hljs-comment">// true</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<h3><a name="t18"></a><span style="color:#fe2c24;">端口号：应用程序在设备中唯一的标识。</span></h3> 
<p><img alt="" height="454" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/48e9598868594525bff8019e4ebbd5c5.png" width="876"></p> 
<p><img alt="" height="426" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/1863ad612ab2444c858f1a155ad4266e.png" width="1141"></p> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">端口号：用两个字节表示的整数，它的取值范围是0-65535，其中，0-1023之间的端口号用于一些知名的网络服务和应用，普通的应用程序需要使用1024以上的端口号。</span></li><li><span style="background-color:#f9eda6;">如果端口号被另外一个服务或者应用所占用，会导致当前程序启动失败。</span></li><li><span style="background-color:#f9eda6;">&nbsp;在我们的设备中，最多只有六万多个端口。</span></li><li><span style="background-color:#f9eda6;">一个端口号只能被一个应用程序使用，不能说是两个应用程序用同一个端口。</span></li><li>如下图，假设现在有两台电脑，一个是电脑A，一个电脑B，那么左边的电脑A要跟右边的电脑B去发送消息，在这个过程中，就有端口的存在。</li><li><span style="background-color:#f9eda6;">端口，可以把它理解成是电脑往外发送数据或者是接收数据的出口或者是入口</span>，说的直白一点，其实就是下图中的各种各样的小眼儿。</li><li>那么这些小眼儿<span style="background-color:#f9eda6;">是有编号的。从0-65535，而我们的软件在启动之后，它一定要跟一个端口进行绑定，如果说你不绑定，那么你当前的程序是单机的，是无法对外发送数据或者是接收数据的。</span></li></ul> 
</blockquote> 
<p><img alt="" height="665" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/9855cb3328eb4cfcad46af94b9fa3675.png" width="1200"></p> 
<h3><a name="t19"></a><span style="color:#fe2c24;">协议：数据传输的规则</span></h3> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">在计算机网络当中，连接和通信的规则被称为网络通信的协议，说白了协议就是数据传输的规则。</span></li><li>那么<span style="background-color:#f9eda6;">在传输数据的时候，国际标准组织定义了一个OSI的参考模型，那么这个模型它是把传输数据分成了七层，但由于这个分法它过于理想化，也太复杂，所以未在因特网上进行广泛的推广</span>，那么<span style="background-color:#f9eda6;">后来呢，把这个模型进行了简化，简化之后叫做TCP/IP模型</span>，那么<span style="background-color:#f9eda6;">这个模型现在正在被广泛的进行使用</span>。</li></ul> 
</blockquote> 
<p><img alt="" height="688" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/9edfe4ec1b2340db8fa96d030c9c0cf3.png" width="1200"></p> 
<h3><a name="t20"></a>&nbsp;<span style="color:#fe2c24;">OSI参考模型</span></h3> 
<p><img alt="" height="677" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/edd1471e450a42f683d6e724d1e6a7f8.png" width="1200"></p> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">在最初的OSI参考模型当中，它是把整个数据的传输分成了七层，那么在发送数据的时候，对方的电脑其实也有这七层，我们的代码时运行在最上面的应用层的</span></li><li>如果说我想要发送一条数据过去，在左边自己的电脑当中，<span style="background-color:#f9eda6;">它会一层一层的往下，在最下面的物理层会把数据最终转换成二进制，再去传给对方的电脑，那么对方的电脑接收到二进制之后会进行解析，再一层一层的传递给最上面的应用层，那么这样呢，我们的程序就可以接收到数据了</span>。</li></ul> 
</blockquote> 
<h3><a name="t21"></a><span style="color:#fe2c24;">&nbsp;TCP/IP参考模型</span></h3> 
<p><img alt="" height="425" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/cd9487e7e1564949b93ca3b3ff55d2c5.png" width="551"></p> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">在TCP/IP模型中，它是把应用层，表示层，会话层进行了合并，三者合一变成应用层</span>，<span style="background-color:#f9eda6;">而下面的传输层和网络层没有发生变化</span>，最后的两层<span style="background-color:#f9eda6;">数据链路层和物理层进行了合并</span>，<span style="background-color:#f9eda6;">变成了物理链路层</span>，<span style="background-color:#f9eda6;">简化之后流程变得简单了，也大大减少了资源的消耗，所以说这个模型一直沿用至今。</span></li><li>那么这里的<span style="background-color:#f9eda6;">每一层其实都有自己的协议</span>，<span style="background-color:#f9eda6;">像应用层的HTTP、FTP、DNS协议这些协议的底层其实就是TCP协议和UDP协议，而TCP协议和UDP协议的底层又用到了下面的IP、ICMP等等，但是最终它们还是会转成0101这样的二进制形式。</span></li></ul> 
</blockquote> 
<h3><a name="t22"></a><span style="color:#fe2c24;">&nbsp;UDP协议(用户数据报协议)</span></h3> 
<blockquote> 
 <ul><li>UDP是无连接的协议，它不保证数据的可靠性和顺序，但是传输速度更快</li><li><span style="background-color:#f9eda6;">UDP适用于需要快速传输的应用程序，如视频和音频流</span></li><li><span style="background-color:#f9eda6;">UDP协议也叫做用户数据报协议</span></li><li><span style="background-color:#f9eda6;">UDP协议，它的特点是面向无连接的通信协议，它的传输速度非常的快，但是它有大小限制，一次最多只能发送64KB，数据不安全，数据容易丢失。</span></li><li>如下图，假设现在是左边的电脑要给右边的电脑去发送数据，<span style="background-color:#f9eda6;">在发送数据之前，按道理来讲，要先检查两台电脑之间的网络是否畅通，但是UDP协议，它是不会检查的，数据就直接发送的，你能收到就收到，收不到就拉倒，这就是面向无连接。</span></li></ul> 
 <h3><a name="t23"></a><span style="color:#fe2c24;">UDP协议的应用场景：</span></h3> 
 <ul><li><span style="background-color:#f9eda6;">UDP协议</span>本身有没有优点，有啊<span style="background-color:#f9eda6;">，它的优点就是传输速度会非常的快</span>，<span style="background-color:#f9eda6;">因为它在发送数据的时候是不需要检查网络的，所以说速度会很快，但是呢它也有缺点，就是因为不检查网络，所以说数据不安全，数据容易丢失。</span></li><li><span style="background-color:#f9eda6;">所以说UDP协议适用于那种丢失一点数据无所谓，不会产生任何影响的情况。</span></li><li><span style="background-color:#f9eda6;">比如说网络会议，丢一点儿数据无所谓，不产生任何的影响</span></li><li><span style="background-color:#f9eda6;">再比如说语音通话，丢一点儿数据也不会有任何的影响，关系不大，大不了啊就是卡了一下而已</span></li><li><span style="background-color:#f9eda6;">再比如说看在线视频的时候，丢一点儿数据也无所谓，对于我们看电影来讲没有任何的影响</span></li><li><span style="background-color:#f9eda6;">所以说在这些情况下，我们一般会用UDP协议进行传输。</span></li></ul> 
</blockquote> 
<p><img alt="" height="230" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/4d34e0c66ead435a99622728a24f0db9.png" width="1179"></p> 
<h3><a name="t24"></a><span style="color:#fe2c24;">&nbsp;TCP协议(传输控制协议)</span></h3> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">TCP协议是面向连接的协议，它提供可靠的数据传输，确保数据的完整性和顺序</span></li><li><span style="background-color:#f9eda6;">TCP适用于需要可靠传输的应用程序，如文件传输和电子邮件</span></li><li><span style="background-color:#f9eda6;">TCP协议，它是面向连接的通信协议，它的速度会比较慢，但是没有大小限制，数据相对来讲会比较安全。</span></li><li><span style="background-color:#f9eda6;">TCP协议是面向连接的通信协议，即传输数据之前，在发送端和接收端建立逻辑连接，然后再传输数据</span></li><li><span style="background-color:#f9eda6;">面向连接：它在发送数据的时候，会先检查两台电脑之间的网络是否畅通，简答来说就是确保连接成功才会发送数据，那么这个就是面向连接。</span></li><li><span style="background-color:#f9eda6;">在TCP连接中必须要明确客户端与服务器端，由客户端向服务端发出连接请求，每次连接的创建都需要经过“三次握手”</span></li><li> <p><a href="https://so.csdn.net/so/search?q=%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B&amp;spm=1001.2101.3001.7020" target="_blank" class="hl hl-1" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.7020&quot;,&quot;dest&quot;:&quot;https://so.csdn.net/so/search?q=%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B&amp;spm=1001.2101.3001.7020&quot;,&quot;extra&quot;:&quot;{\&quot;searchword\&quot;:\&quot;三次握手\&quot;}&quot;}" data-tit="三次握手" data-pretit="三次握手">三次握手</a>：TCP协议中，<span style="background-color:#f9eda6;">在发送数据的准备阶段，客户端与服务器之间的三次交互，以保证连接的可靠</span></p> <p><span style="background-color:#f9eda6;">第一次握手，客户端向服务器端发出连接请求，等待服务器确认</span></p> <p><span style="background-color:#f9eda6;">第二次握手，服务器端向客户端回送一个响应，通知客户端收到了连接请求</span></p> <p><span style="background-color:#f9eda6;">第三次握手，客户端再次向服务器端发送确认信息，确认连接</span></p> </li><li> <p><span style="background-color:#f9eda6;">完成三次握手，连接建立后，客户端和服务器就可以开始进行数据传输了</span>。<span style="background-color:#f9eda6;">由于这种面向连接的特性，TCP协议可以保证传输数据的安全，所以应用十分广泛。例如上传文件、下载文件、浏览网页等</span></p> </li></ul> 
 <h3><a name="t25"></a><span style="color:#fe2c24;">TCP协议的应用场景：</span></h3> 
 <ul><li><span style="background-color:#f9eda6;">TCP协议适用于那种对数据有非常高的要求，一点儿都不能丢的情况</span></li><li>比如说<span style="background-color:#f9eda6;">下载软件</span>，你丢一点儿数据，安装包有可能就用不了了</li><li>再比如说<span style="background-color:#f9eda6;">文字聊天</span>，你发消息，少一个字，意思有可能就变了</li><li>再比如说<span style="background-color:#f9eda6;">发送邮件</span>，同样的，数据也不能丢失</li><li>那么这些情况就适合用TCP协议进行传输</li></ul> 
</blockquote> 
<p><img alt="" height="222" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e3250cb36e8f4f7fa2090d0eff43c8e6.png" width="1177"></p> 
<h1><a name="t26"></a>三. UDP通信程序</h1> 
<h3><a name="t27"></a><span style="color:#fe2c24;">3.1 UDP协议发送数据</span></h3> 
<p><img alt="" height="456" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/15ef182baa4a4cb3b4862a85a8e5c27a.png" width="813"></p> 
<blockquote> 
 <ul><li><img alt="" height="459" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/8ce47295b5b5455d9dcff85e4843eee1.png" width="913"><span style="background-color:#f9eda6;">在创建发送端的DatagramSocket对象的时候，我们可以利用空参构造什么都不传，利用随机的端口进行发送，也可以给它指定一个端口。</span></li><li><span style="background-color:#f9eda6;">在创建DatagramSocket对象的时候，它还会去绑定对应的端口，在以后我们就是通过这个端口往外发送数据。</span></li><li><span style="background-color:#f9eda6;">空参：如果说你是用空参的，那么此时它会在所有可用的端口中，随机一个进行使用。</span></li><li><span style="background-color:#f9eda6;">有参：指定端口号进行帮绑定</span></li><li><img alt="" height="504" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a44cce15321e433988fb85a7921eb72d.png" width="1073"></li><li><span style="background-color:#f9eda6;">用DatagramPacket打包数据的时候，数据是利用字节数组往外发，那么在发的时候你可以指定是从哪个索引开始，一共要发几个，起始索引offset，要全部发送，length就写数组的长度即可，IneAddress表示我要给哪台电脑发，所以说可以在InetAddress这个地方去指定IP，port表示你要发给这台电脑的哪个端口上。</span></li><li><img alt="" height="249" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a4c3e2f7af57465397a4edbaf341fb08.png" width="968"></li></ul> 
</blockquote> 
<pre data-index="2" class="" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d2_udp_demo;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.IOException;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.*;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   UDP协议发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">SendMessageDemo</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> IOException {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建发送端的DatagramSocket对象(快递公司)</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 在创建DatagramSocket对象的时候,我们可以利用空参构造什么都不传,利用随机的端口进行发送</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 也可以给它指定一个端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 细节:</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//      在创建DatagramSocket对象的时候,它还会去绑定对应的端口,</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//      那么在以后我们就是通过这个端口往外发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 空参:如果说你是用空参的,那么此时它会在所有可用的端口中,随机一个进行使用</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 有参:指定端口号进行绑定</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">DatagramSocket</span> <span class="hljs-variable">ds</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">DatagramSocket</span>();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.打包数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 要发送的数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">String</span> <span class="hljs-variable">str</span> <span class="hljs-operator">=</span> <span class="hljs-string">"你好厉害呀"</span>;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 把字符串转为字节数组</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">byte</span>[] bytes = str.getBytes();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 获取InetAddress的对象,表示IP的对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">InetAddress</span> <span class="hljs-variable">address</span> <span class="hljs-operator">=</span> InetAddress.getByName(<span class="hljs-string">"127.0.0.1"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 指定端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">int</span> <span class="hljs-variable">port</span> <span class="hljs-operator">=</span> <span class="hljs-number">10086</span>;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">DatagramPacket</span> <span class="hljs-variable">dp</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">DatagramPacket</span>(bytes,bytes.length,address,port);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ds.send (dp);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ds.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<p><img alt="" height="127" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/99b6179ba9e54e23b2d042596a4a9f9f.png" width="585"></p> 
<blockquote> 
 <p><span style="background-color:#f9eda6;">&nbsp;问题：为什么控制台什么都不显示？</span></p> 
 <ul><li><span style="background-color:#f9eda6;">原因：因为我们是利用UDP协议去发送数据，UDP协议是无连接的，在发送数据的时候它不会检查两台电脑的网络是否畅通，它是直接发送的，你能收到就收到，收不到就拉到。</span></li></ul> 
</blockquote> 
<h3><a name="t28"></a><span style="color:#fe2c24;">3.2 UDP协议接收数据</span></h3> 
<p><img alt="" height="461" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/095ed6bdeb884f99b548d53a88ea8a18.png" width="952"></p> 
<pre data-index="3" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d2_udp_demo;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.DatagramPacket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.DatagramSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.InetAddress;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.SocketException;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   UDP协议接收数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">ReceiveMessageDemo</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建接收端的DatagramSocket对象(快递公司)</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 细节:</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//     在接收的时候,一定要手动绑定端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//     而且绑定的端口一定要跟发送的端口保持一致</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">DatagramSocket</span> <span class="hljs-variable">ds</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">DatagramSocket</span>(<span class="hljs-number">10086</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 创建字节数组用来保存接收过来的信息</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">byte</span>[] bytes = <span class="hljs-keyword">new</span> <span class="hljs-title class_">byte</span>[<span class="hljs-number">1024</span>];</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.数据包,存储接收到的数据  接收数据只需要给它传递一个数组就可以了</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">DatagramPacket</span> <span class="hljs-variable">dp</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">DatagramPacket</span>(bytes,bytes.length);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.接收数据包</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 该方法是阻塞的</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 程序执行到这一步的时候,会在这里死等</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 等发送端发送消息</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ds.receive(dp);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.解析数据包</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">byte</span>[] data = dp.getData();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">       <span class="hljs-comment">// System.out.println(data.length); // 1024</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">int</span> <span class="hljs-variable">len</span> <span class="hljs-operator">=</span> dp.getLength();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">         <span class="hljs-comment">// 获取发送端的IP</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">      <span class="hljs-comment">//  System.out.println(dp.getSocketAddress()); // /127.0.0.1:50167</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">InetAddress</span> <span class="hljs-variable">address</span> <span class="hljs-operator">=</span> dp.getAddress();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 获取发送端的端口号</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">int</span> <span class="hljs-variable">port</span> <span class="hljs-operator">=</span> dp.getPort();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(<span class="hljs-string">"接收到数据:"</span> + <span class="hljs-keyword">new</span> <span class="hljs-title class_">String</span>(data,<span class="hljs-number">0</span>,len));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(<span class="hljs-string">"该数据是从"</span> + address + <span class="hljs-string">"这台电脑中的"</span> + port + <span class="hljs-string">"这个端口发出的"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 5.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="46"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ds.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="47"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="48"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<ul><li><strong><span style="color:#fe2c24;">在运行的时候，要先来运行接收端，再来运行发送端，这样子才是可以的！</span></strong></li></ul> 
<p><strong>问题1：为啥这里的端口不是10086而是58694呢？</strong></p> 
<ul><li><strong><span style="color:#fe2c24;">因为我们在发送端是利用空参构造创建的DatagramSocket对象，它会随机一个端口进行使用</span></strong></li></ul> 
<p>&nbsp;<img alt="" height="115" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/448e65b4f8a44ab9b96dd5affacd3d97.png" width="532"></p> 
<p></p> 
<h3><a name="t29"></a><span style="color:#fe2c24;">3.3 UDP练习-聊天室</span></h3> 
<p><img alt="" height="262" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/d37288f92f664c4f99b38d0ea54d8532.png" width="1099"></p> 
<h3><a name="t30"></a><span style="color:#fe2c24;">&nbsp;发送端代码实现：</span></h3> 
<pre data-index="4" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d3_udp_demo;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.DatagramPacket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.DatagramSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.InetAddress;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.Objects;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.Scanner;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">SendMessageDemo</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">           按照下面的要求实现程序</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">               UDP发送数据:数据来自于键盘录入,直到输入的数据是886,发送数据结束</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">               UDP接收数据:因为接收端不知道发送端什么时候停止发送,故采用死循环接收</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建发送端的DatagramSocket对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 细节:在创建DatagramSocket对象的时候,它会去绑定对应的端口,在以后我们就是通过这个端口往外发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">DatagramSocket</span> <span class="hljs-variable">ds</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">DatagramSocket</span>();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.打包数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Scanner</span> <span class="hljs-variable">sc</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Scanner</span>(System.in);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span> (<span class="hljs-literal">true</span>) {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(<span class="hljs-string">"请输入您要说的话:"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">String</span> <span class="hljs-variable">str</span> <span class="hljs-operator">=</span> sc.nextLine();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-keyword">if</span>(Objects.equals(<span class="hljs-string">"886"</span>,str)){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(<span class="hljs-string">"离线成功!"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                ds.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                <span class="hljs-keyword">break</span>;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">byte</span>[] bytes = str.getBytes();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 要发给哪台电脑的哪个端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 获取InetAddress的对象,表示IP的对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">InetAddress</span> <span class="hljs-variable">address</span> <span class="hljs-operator">=</span> InetAddress.getByName(<span class="hljs-string">"127.0.0.1"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 指定端口号</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">int</span> <span class="hljs-variable">port</span> <span class="hljs-operator">=</span> <span class="hljs-number">2002</span>;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">DatagramPacket</span> <span class="hljs-variable">dp</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">DatagramPacket</span>(bytes,bytes.length,address,port);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 3.发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            ds.send(dp);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ds.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt" data-report-view="{&quot;spm&quot;:&quot;1001.2101.3001.7365&quot;}"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<h3><a name="t31"></a><span style="color:#fe2c24;">&nbsp;接收端代码实现：</span></h3> 
<pre data-index="5" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:1150px"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d3_udp_demo;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.DatagramPacket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.DatagramSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.InetAddress;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">ReceiveMessageDemo</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">         <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">           按照下面的要求实现程序</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">               UDP发送数据:数据来自于键盘录入,直到输入的数据是886,发送数据结束</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">               UDP接收数据:因为接收端不知道发送端什么时候停止发送,故采用死循环接收</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建接收端的DatagramSocket对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 细节:</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//      在接收的时候,一定要手动绑定端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//      而且绑定的端口一定要跟发送的端口保持一致</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 这个端口就表示你要从哪个端口上去接收数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">DatagramSocket</span> <span class="hljs-variable">ds</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">DatagramSocket</span>(<span class="hljs-number">2002</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.数据包,存储接收到的数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 创建字节数组,保存接收到的信息</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">byte</span>[] bytes = <span class="hljs-keyword">new</span> <span class="hljs-title class_">byte</span>[<span class="hljs-number">1024</span>];</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">DatagramPacket</span> <span class="hljs-variable">dp</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">DatagramPacket</span>(bytes, bytes.length);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span> (<span class="hljs-literal">true</span>) {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 3.接收数据包</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            ds.receive(dp);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 4.解析数据包</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 调用getData()可以获取发送过来的数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">byte</span>[] data = dp.getData();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 调用getLength()获取当前接收到了多少字节</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">int</span> <span class="hljs-variable">len</span> <span class="hljs-operator">=</span> dp.getLength();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 获取发送端的电脑对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">InetAddress</span> <span class="hljs-variable">address</span> <span class="hljs-operator">=</span> dp.getAddress();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 获取发送端的IP,这个才是真正的IP</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">String</span> <span class="hljs-variable">ip</span> <span class="hljs-operator">=</span> dp.getAddress().getHostAddress();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 获取发送端的主机名</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">String</span> <span class="hljs-variable">name</span> <span class="hljs-operator">=</span> dp.getAddress().getHostName();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 获取发送端的端口号</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">int</span> <span class="hljs-variable">port</span> <span class="hljs-operator">=</span> dp.getPort();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(<span class="hljs-string">"接收到数据:"</span> + <span class="hljs-keyword">new</span> <span class="hljs-title class_">String</span>(data,<span class="hljs-number">0</span>,len));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="46"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(<span class="hljs-string">"该数据是从"</span> + address + <span class="hljs-string">"这台电脑, "</span> + <span class="hljs-string">"IP为:"</span> + ip + <span class="hljs-string">", 主机名为:"</span> + name + <span class="hljs-string">"中的"</span> + port + <span class="hljs-string">"这个端口发出的!"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="47"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="48"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="49"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt" data-report-view="{&quot;spm&quot;:&quot;1001.2101.3001.7365&quot;}"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<p><img alt="" height="326" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/facbcd28d14d4af59d1e48f5442a8a2f.png" width="1115"></p> 
<p><img alt="" height="415" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/75b6d3041ee34067bbf63fbd47e59824.png" width="1200"></p> 
<h3><a name="t32"></a><span style="color:#fe2c24;">&nbsp;允许这个类可以重复的运行多次：</span></h3> 
<p><span style="color:#fe2c24;">&nbsp;</span><img alt="" height="392" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/66427bd5e011479d9540f3fbe6ba27c5.png" width="526"></p> 
<h3><a name="t33"></a><img alt="" height="713" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a2ff806cc9a241bfb5e0a7e3127ba808.png" width="1173"><span style="color:#fe2c24;">&nbsp;</span></h3> 
<h3><a name="t34"></a><span style="color:#fe2c24;">3.4 UDP的三种通信方式：单播、组播、广播</span></h3> 
<ul><li><span style="color:#fe2c24;"><strong>单播</strong></span>：<span style="background-color:#f9eda6;">其实就是一对一，左边的发送端只能给右边接收端的一台电脑去发送数据。</span></li></ul> 
<p><img alt="" height="524" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/72489673ed4f4ec69c8bf3fbbc8a28fd.png" width="1200"></p> 
<ul><li><span style="color:#fe2c24;"><strong>&nbsp;组播</strong></span>：<span style="background-color:#f9eda6;">就是现在可以给一组电脑去发送信息，比如说左边是发送端，但是右边的接收端可以&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 是一组。</span><img alt="" height="576" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/fd7f5de80ea546a8899129f54ed9d3bc.png" width="1200"></li><li><span style="color:#fe2c24;"><strong>&nbsp;广播</strong></span>：<span style="background-color:#f9eda6;">左边的发送端可以给局域网当中所有的电脑发送数据，这就叫广播。</span><img alt="" height="609" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/73a018553c914c56b4d696ab7e412828.png" width="1200"></li></ul> 
<blockquote> 
 <ul><li>&nbsp;<span style="background-color:#f9eda6;">之前所有的IP只能表示一台电脑，而这里随便的一个组播地址，它就可以表示多台电&nbsp; &nbsp;脑。</span></li><li><span style="background-color:#f9eda6;">如果发送数据的IP地址是这个组播地址，那此时这一组所有的电脑都可以接收到这个数据了。</span></li><li><span style="background-color:#f9eda6;">广播：在发送消息的时候，发送端的IP地址发到的是255.255.255.255，那么此时在局&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;域网里面所有的电脑都可以接收到你的这个信息，这就是广播。广播地址是UDP&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;独有的！</span><img alt="" height="645" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/6f27049a639d41f6878ff0e1a80ad71f.png" width="966"></li></ul> 
</blockquote> 
<h1><a name="t35"></a><span style="color:#fe2c24;">四. TCP通信程序</span></h1> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">发送端：即客户端(Client)，负责发送数据，用的是输出流，Socket</span></li><li><span style="background-color:#f9eda6;">接收端：即服务端(Server)，负责接收数据，用的是输入流ServerSocket</span></li><li><span style="background-color:#f9eda6;">连接一旦建立之后，会通过IO流进行网络通信。</span></li><li><span style="background-color:#f9eda6;">客户端和服务器在发送数据之间，一定要保证连接已经建立，如果是连接不建立的话，TCP是无法发送数据的。</span></li><li><span style="background-color:#f9eda6;">先运行服务端，再来运行客户端！</span></li><li><img alt="" height="88" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e59c743af226474388fff7df93cec3d5.png" width="921"></li></ul> 
</blockquote> 
<p><img alt="" height="670" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/09e3ebccf8894a6997f8f12b34131628.png" width="1200"></p> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">在创建客户端的Socket对象的时候，需要传递服务器的IP还有端口号。</span></li><li><span style="background-color:#f9eda6;">服务器绑定的端口必须跟客户端连接的端口保持一致，服务器端调用accept方法去等待客户端来连接！</span></li><li><span style="background-color:#f9eda6;">IO流是在连接通道里面的，所以说在释放资源的时候只需要关闭通道即可。</span></li><li><img alt="" height="440" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/46e7f923d70944f0bfe507492d0517a8.png" width="1140"></li><li><img alt="" height="407" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/cf01a18b95714b69ba7862714a6b2d7c.png" width="845"></li></ul> 
</blockquote> 
<h3><a name="t36"></a><img alt="" height="709" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/4bc4eea055624831804f5cdb9c52c9c5.png" width="1200">&nbsp;<span style="color:#fe2c24;">客户端代码：利用TCP协议，去发送数据</span></h3> 
<pre data-index="6" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d5_tcp_demo;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.OutputStream;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   客户端:利用TCP协议,去发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Client</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建Socket对象:需要传递服务器的IP还有端口号</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 细节:在创建对象的同时会连接服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//     如果连接不上,运行后代码会报错</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Socket</span>(<span class="hljs-string">"127.0.0.1"</span>,<span class="hljs-number">10086</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.可以从连接通道中获取输出流</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">OutputStream</span> <span class="hljs-variable">os</span> <span class="hljs-operator">=</span> socket.getOutputStream();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 写出数据  字节流往外写出的时候只能写字节信息</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 中文会乱码</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        os.write(<span class="hljs-string">"你好你好"</span>.getBytes());</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// os.close();</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<h3><a name="t37"></a>&nbsp;<span style="color:#fe2c24;">服务器端代码：利用TCP协议，接收数据</span></h3> 
<pre data-index="7" class="" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d5_tcp_demo;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.BufferedReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.InputStream;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.InputStreamReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.ServerSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   服务端:利用TCP协议,接收数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Server</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception{</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建服务端的ServerSocket对象:服务器端绑定的端口一定要跟客户端连接的端口保持一致</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">ServerSocket</span> <span class="hljs-variable">ss</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">ServerSocket</span>(<span class="hljs-number">10086</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.监听客户端连接:去死等客户端来连</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 一旦有客户端来连，它就会返回客户端的连接对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> ss.accept();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.从连接通道中获取输入流读取数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">      <span class="hljs-comment"><span class="hljs-comment">/*InputStream is = socket.getInputStream();</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">        // 字符输入转换流:把is变成了字符流</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">        InputStreamReader isr = new InputStreamReader(is);</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">        // 字符缓冲输入流</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">        BufferedReader br = new BufferedReader(isr);*/</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedReader</span> <span class="hljs-variable">br</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedReader</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">InputStreamReader</span>(socket.getInputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        String line;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((line = br.readLine()) != <span class="hljs-literal">null</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(line);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">       <span class="hljs-comment">// int b;</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">      <span class="hljs-comment">//  while((b = br.read()) != -1){</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">      <span class="hljs-comment">//      System.out.print((char)b);</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">      <span class="hljs-comment">//  }</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 这行代码是相当于断开了跟客户端之间的连接</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 这行代码相当于就是关闭了服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ss.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="46"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<h3><a name="t38"></a><span style="color:#fe2c24;">&nbsp;TCP代码细节：</span></h3> 
<blockquote> 
 <ul><li><span style="background-color:#f9eda6;">TCP协议的三次握手协议保证连接建立</span></li><li><span style="background-color:#f9eda6;">利用四次挥手协议保证断开连接，而且需要保证服务端已经把连接通道里面的数据已经处理完毕了。</span></li></ul> 
</blockquote> 
<p><img alt="" height="531" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/df5ce002a2e040288ff96685b4dddf25.png" width="1200"></p> 
<p>&nbsp;<img alt="" height="669" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/2f276bfabb3f4564bbea20949fd38c98.png" width="1024"></p> 
<p><img alt="" height="718" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/7492205e5911488099b9505c6703f46f.png" width="1200"></p> 
<p><img alt="" height="705" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/7437721869d440f5a43c8781c3621dbb.png" width="1200"></p> 
<h3><a name="t39"></a><span style="color:#fe2c24;">TCP通信程序的综合练习：</span></h3> 
<p>###<strong> </strong><span style="color:#fe2c24;"><strong>练习一</strong></span>：多发多收</p> 
<p>需求：</p> 
<p>​&nbsp;&nbsp; &nbsp;客户端：多次发送数据</p> 
<p>​&nbsp;&nbsp; &nbsp;服务器：接收多次接收数据，并打印</p> 
<p>代码示例：</p> 
<pre data-index="8" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d7_test1;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.OutputStream;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.Scanner;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   客户端:利用TCP协议发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Client</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            多发多收</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:多次发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务端:接收多次接收数据,并打印</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建客户端的Socket对象并连接服务端</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Socket</span>(<span class="hljs-string">"127.0.0.1"</span>,<span class="hljs-number">528</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.从连接管道中获取输出流,写出数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">OutputStream</span> <span class="hljs-variable">os</span> <span class="hljs-operator">=</span> socket.getOutputStream();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 写出数据:字节流往外写数据的时候只能写字节信息</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Scanner</span> <span class="hljs-variable">sc</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Scanner</span>(System.in);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span> (<span class="hljs-literal">true</span>) {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(<span class="hljs-string">"请输入您要发送的信息:"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">String</span> <span class="hljs-variable">str</span> <span class="hljs-operator">=</span> sc.nextLine();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-keyword">if</span>(<span class="hljs-string">"886"</span>.equals(str)){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                <span class="hljs-keyword">break</span>;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            os.write(str.getBytes());</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<p><strong><span style="color:#fe2c24;">&nbsp;服务器端代码：</span></strong></p> 
<pre data-index="9" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d7_test1;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.BufferedReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.InputStream;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.InputStreamReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.ServerSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   服务端:利用TCP协议接收数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Server</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">         <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            多发多收</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:多次发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务端:接收多次接收数据,并打印</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建服务器端的ServerSocket对象绑定客户端连接的端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">ServerSocket</span> <span class="hljs-variable">ss</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">ServerSocket</span>(<span class="hljs-number">528</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.监听客户端连接:等待客户端连接,一旦有客户端来连,会返回客户端的连接对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> ss.accept();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.从连接管道中获取输入流读取数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">//        InputStream is = socket.getInputStream();</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 字符缓冲输入流                          字符输入转换流                字节输入流</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedReader</span> <span class="hljs-variable">br</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedReader</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">InputStreamReader</span>(socket.getInputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        String line;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((line = br.readLine()) != <span class="hljs-literal">null</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(line);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">      <span class="hljs-comment"><span class="hljs-comment">/*  int b;</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">        while((b = br.read()) != -1){</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            System.out.print((char)b);</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">        }*/</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 这行代码相当于断开了跟客户端之间的连接</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 关闭了服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ss.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="46"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<p><img alt="" height="288" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/b4d99a0b4e2045b5b845782de72d1cf3.png" width="615"></p> 
<p>&nbsp;<img alt="" height="175" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/3b8bc86d3bb7408c88084a29d1337fe5.png" width="665"></p> 
<p>###<span style="color:#fe2c24;"><strong> 练习二</strong></span>：接收并反馈</p> 
<p>客户端:发送一条数据,接收服务端反馈的消息并打印<br> 服务器:接收数据并打印,再给客户端反馈消息</p> 
<pre data-index="10" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d8_test2;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.BufferedReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.InputStreamReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.OutputStream;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.Scanner;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   客户端:利用TCP协议发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Client</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception{</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            接收并反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:发送一条数据,接收服务端反馈的消息并打印</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务器:接收数据并打印,再给客户端反馈消息</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建客户端的Socket对象并连接服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Socket</span>(<span class="hljs-string">"127.0.0.1"</span>, <span class="hljs-number">8080</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.从连接管道中获取输出流,写出数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">OutputStream</span> <span class="hljs-variable">os</span> <span class="hljs-operator">=</span> socket.getOutputStream();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 写出数据:字节流往外写数据的时候只能写字节信息</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">String</span> <span class="hljs-variable">str</span> <span class="hljs-operator">=</span> <span class="hljs-string">"见到你很高兴"</span>;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        os.write(str.getBytes());</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 写出一个结束标记</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.shutdownOutput();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.接收服务端回写的数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedReader</span> <span class="hljs-variable">br</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedReader</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">InputStreamReader</span>(socket.getInputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        String line;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((line = br.readLine()) != <span class="hljs-literal">null</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(line);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<pre data-index="11" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d8_test2;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.BufferedReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.IOException;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.InputStreamReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.OutputStream;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.ServerSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   服务端:利用TCP协议接收数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Server</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> IOException {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">         <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            接收并反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:发送一条数据,接收服务端反馈的消息并打印</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务器:接收数据并打印,再给客户端反馈消息</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建服务器端的ServerSocket对象绑定客户端连接的端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">ServerSocket</span> <span class="hljs-variable">ss</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">ServerSocket</span>(<span class="hljs-number">8080</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.监听客户端连接:等待客户端连接,一旦有客户端来连接,会返回客户端的连接对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> ss.accept();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.从连接管道中获取输入流读取数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 字符缓冲输入流                          字符输入转换流                字节输入流</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedReader</span> <span class="hljs-variable">br</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedReader</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">InputStreamReader</span>(socket.getInputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        String line;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 细节:</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//      read方法会从连接通道中读取数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//      但是,需要有一个结束标记,此时的循环才会停止</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">//      否则,程序就会一致停在read方法这里,等待读取下面的数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((line = br.readLine()) != <span class="hljs-literal">null</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.print(line);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.回写数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">OutputStream</span> <span class="hljs-variable">os</span> <span class="hljs-operator">=</span> socket.getOutputStream();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">String</span> <span class="hljs-variable">str</span> <span class="hljs-operator">=</span> <span class="hljs-string">"到底有多高兴呢?"</span>;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        os.write(str.getBytes());</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 5.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 表示断开与客户端之间的连接</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="46"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="47"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 表示关闭服务器端</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="48"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ss.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="49"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="50"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<h3><a name="t40"></a><span style="color:#fe2c24;">练习三</span>：上传练习（TCP协议）</h3> 
<ul><li> <p>案例需求</p> <p>客户端：数据来自于本地文件，接收服务器反馈</p> <p>服务器：接收到的数据写入本地文件，给出反馈</p> </li></ul> 
<pre data-index="12" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:952px"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d9_test3;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.*;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   客户端:利用TCP协议负责发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Client</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> IOException {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            上传文件</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:将本地文件上传到服务器,接收服务器的反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务器:接收客户端上传的文件,上传完毕之后给出反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建客户端的Socket对象并连接服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Socket</span>(<span class="hljs-string">"127.0.0.1"</span>,<span class="hljs-number">10087</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.读取本地文件中的数据,并写到服务器当中</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedInputStream</span> <span class="hljs-variable">bis</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedInputStream</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">FileInputStream</span>(<span class="hljs-string">"day12-net-demo/client.dir/1.png"</span>));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedOutputStream</span> <span class="hljs-variable">bos</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedOutputStream</span>(socket.getOutputStream());</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">byte</span>[] bytes = <span class="hljs-keyword">new</span> <span class="hljs-title class_">byte</span>[<span class="hljs-number">1024</span>];</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">int</span> len;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((len = bis.read(bytes)) != -<span class="hljs-number">1</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            bos.write(bytes,<span class="hljs-number">0</span>,len);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.往服务器写出结束标记</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.shutdownOutput();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.接收服务器的回写数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedReader</span> <span class="hljs-variable">br</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedReader</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">InputStreamReader</span>(socket.getInputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        String line;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((line = br.readLine()) != <span class="hljs-literal">null</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(line);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 5.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<pre data-index="13" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:1113px"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d9_test3;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> sun.net.www.content.image.png;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.*;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.ServerSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.UUID;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   利用TCP协议,负责接收数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Server</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> IOException {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">          <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            上传文件</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:将本地文件上传到服务器,接收服务器的反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务器:接收客户端上传的文件,上传完毕之后给出反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建服务器端的ServerSocket对象并绑定客户端连接的端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">ServerSocket</span> <span class="hljs-variable">ss</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">ServerSocket</span>(<span class="hljs-number">10087</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.监听客户端连接:等待客户端来连接</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> ss.accept();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.读取数据并保存到本地文件中</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedInputStream</span> <span class="hljs-variable">bis</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedInputStream</span>(socket.getInputStream());</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">String</span> <span class="hljs-variable">name</span> <span class="hljs-operator">=</span> UUID.randomUUID().toString().replace(<span class="hljs-string">"-"</span>,<span class="hljs-string">""</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedOutputStream</span> <span class="hljs-variable">bos</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedOutputStream</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">FileOutputStream</span>(<span class="hljs-string">"day12-net-demo/server-dir/server/"</span> + name + <span class="hljs-string">".png"</span>));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">int</span> len;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">byte</span>[] bytes = <span class="hljs-keyword">new</span> <span class="hljs-title class_">byte</span>[<span class="hljs-number">1024</span>];</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((len = bis.read(bytes)) != -<span class="hljs-number">1</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            bos.write(bytes,<span class="hljs-number">0</span>,len);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.回写数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedWriter</span> <span class="hljs-variable">bw</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedWriter</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">OutputStreamWriter</span>(socket.getOutputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        bw.write(<span class="hljs-string">"上传成功!"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        bw.newLine(); <span class="hljs-comment">// 换行</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        bw.flush(); <span class="hljs-comment">// 刷新流</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 5.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 关闭连接通道,断开跟客户端之间的连接</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="46"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 关闭服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="47"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ss.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="48"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="49"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<pre data-index="14" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d9_test3;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.UUID;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   UUID一个表示不可变的通用唯一标识符的类</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   UUID可以生成一个随机的字符串,而且字符串的内容是唯一的</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">UUIDTest</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">//        System.out.println(UUID.randomUUID());</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">String</span> <span class="hljs-variable">str</span> <span class="hljs-operator">=</span> UUID.randomUUID().toString().replace(<span class="hljs-string">"-"</span>,<span class="hljs-string">""</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        System.out.println(str);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt" data-report-view="{&quot;spm&quot;:&quot;1001.2101.3001.7365&quot;}"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<h3><a name="t41"></a><span style="color:#fe2c24;">多线程 ，线程池版的服务端：</span><br> &nbsp;</h3> 
<pre data-index="15" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:952px"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d10_test4;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.*;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   客户端:利用TCP协议负责发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Client</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> IOException {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            上传文件</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:将本地文件上传到服务器,接收服务器的反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务器:接收客户端上传的文件,上传完毕之后给出反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建客户端的Socket对象并连接服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">Socket</span>(<span class="hljs-string">"127.0.0.1"</span>,<span class="hljs-number">10087</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.读取本地文件中的数据,并写到服务器当中</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedInputStream</span> <span class="hljs-variable">bis</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedInputStream</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">FileInputStream</span>(<span class="hljs-string">"day12-net-demo/client.dir/1.png"</span>));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedOutputStream</span> <span class="hljs-variable">bos</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedOutputStream</span>(socket.getOutputStream());</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">byte</span>[] bytes = <span class="hljs-keyword">new</span> <span class="hljs-title class_">byte</span>[<span class="hljs-number">1024</span>];</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">int</span> len;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((len = bis.read(bytes)) != -<span class="hljs-number">1</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            bos.write(bytes,<span class="hljs-number">0</span>,len);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.往服务器写出结束标记</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.shutdownOutput();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.接收服务器的回写数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedReader</span> <span class="hljs-variable">br</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedReader</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">InputStreamReader</span>(socket.getInputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        String line;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((line = br.readLine()) != <span class="hljs-literal">null</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(line);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 5.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<pre data-index="16" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d10_test4;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.*;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.ServerSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.UUID;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.concurrent.*;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   利用TCP协议,负责接收数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Server</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> IOException {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">          <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            上传文件</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:将本地文件上传到服务器,接收服务器的反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务器:接收客户端上传的文件,上传完毕之后给出反馈</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 创建线程池对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">ExecutorService</span> <span class="hljs-variable">pool</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">ThreadPoolExecutor</span>(</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                <span class="hljs-number">3</span>,<span class="hljs-comment">// 核心线程数量</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                <span class="hljs-number">6</span>, <span class="hljs-comment">// 最大线程数量</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                <span class="hljs-number">60</span>, <span class="hljs-comment">// 空闲线程的存活时间</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                TimeUnit.SECONDS, <span class="hljs-comment">// 存活时间单位</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                <span class="hljs-keyword">new</span> <span class="hljs-title class_">ArrayBlockingQueue</span>&lt;&gt;(<span class="hljs-number">3</span>), <span class="hljs-comment">// 任务的阻塞队列</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                Executors.defaultThreadFactory(), <span class="hljs-comment">// 线程的创建工厂</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                <span class="hljs-keyword">new</span> <span class="hljs-title class_">ThreadPoolExecutor</span>.AbortPolicy()); <span class="hljs-comment">// 任务的拒绝策略</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建服务器端的ServerSocket对象并绑定客户端连接的端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">ServerSocket</span> <span class="hljs-variable">ss</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">ServerSocket</span>(<span class="hljs-number">10087</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span> (<span class="hljs-literal">true</span>) {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 2.监听客户端连接:等待客户端来连接</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> ss.accept();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 开启一条线程</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 一个用户就对应服务端的一条线程</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">//            new Thread(new MyRunnable(socket)).start();</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            pool.execute(<span class="hljs-keyword">new</span> <span class="hljs-title class_">MyRunnable</span>(socket));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 关闭服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">//        ss.close();</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="46"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<pre data-index="17" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:1144px"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d10_test4;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.*;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.util.UUID;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">MyRunnable</span> <span class="hljs-keyword">implements</span> <span class="hljs-title class_">Runnable</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">private</span> Socket socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> Socket <span class="hljs-title function_">getSocket</span><span class="hljs-params">()</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">return</span> socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">setSocket</span><span class="hljs-params">(Socket socket)</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-built_in">this</span>.socket = socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-title function_">MyRunnable</span><span class="hljs-params">(Socket socket)</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-built_in">this</span>.socket = socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-meta">@Override</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">run</span><span class="hljs-params">()</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">try</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 3.读取数据并保存到本地文件中</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">BufferedInputStream</span> <span class="hljs-variable">bis</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedInputStream</span>(socket.getInputStream());</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">String</span> <span class="hljs-variable">name</span> <span class="hljs-operator">=</span> UUID.randomUUID().toString().replace(<span class="hljs-string">"-"</span>,<span class="hljs-string">""</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">BufferedOutputStream</span> <span class="hljs-variable">bos</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedOutputStream</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">FileOutputStream</span>(<span class="hljs-string">"day12-net-demo/server-dir/server/"</span> + name + <span class="hljs-string">".png"</span>));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">int</span> len;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">byte</span>[] bytes = <span class="hljs-keyword">new</span> <span class="hljs-title class_">byte</span>[<span class="hljs-number">1024</span>];</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-keyword">while</span>((len = bis.read(bytes)) != -<span class="hljs-number">1</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                bos.write(bytes,<span class="hljs-number">0</span>,len);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 4.回写数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-type">BufferedWriter</span> <span class="hljs-variable">bw</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedWriter</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">OutputStreamWriter</span>(socket.getOutputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            bw.write(<span class="hljs-string">"上传成功!"</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            bw.newLine(); <span class="hljs-comment">// 换行</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            bw.flush(); <span class="hljs-comment">// 刷新流</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        } <span class="hljs-keyword">catch</span> (IOException e) {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">RuntimeException</span>(e);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        } <span class="hljs-keyword">finally</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 5.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-comment">// 关闭连接通道,断开跟客户端之间的连接</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="46"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            <span class="hljs-keyword">if</span>(socket != <span class="hljs-literal">null</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="47"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                <span class="hljs-keyword">try</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="48"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                    socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="49"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                } <span class="hljs-keyword">catch</span> (IOException e) {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="50"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                    <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">RuntimeException</span>(e);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="51"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">                }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="52"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="53"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="54"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="55"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<h3><a name="t42"></a><span style="color:#fe2c24;">BS架构模型：BS架构不需要不需要开发客户端，只需要开发服务器即可！</span></h3> 
<pre data-index="18" class="set-code-hide" name="code"><code class="language-java hljs"><ol class="hljs-ln" style="width:100%"><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="1"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">package</span> com.gch.d7_test1;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="2"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.BufferedReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="4"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.io.InputStreamReader;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="5"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.ServerSocket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="6"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">import</span> java.net.Socket;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="7"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="8"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"><span class="hljs-comment">/**</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="9"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">   服务端:利用TCP协议接收数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="10"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment"> */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="11"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-keyword">public</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">Server</span> {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="12"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title function_">main</span><span class="hljs-params">(String[] args)</span> <span class="hljs-keyword">throws</span> Exception {</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="13"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">         <span class="hljs-comment"><span class="hljs-comment">/*</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="14"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            多发多收</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="15"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            客户端:多次发送数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="16"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            服务端:接收多次接收数据,并打印</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="17"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">         */</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="18"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="19"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 1.创建服务器端的ServerSocket对象绑定客户端连接的端口</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="20"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">ServerSocket</span> <span class="hljs-variable">ss</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">ServerSocket</span>(<span class="hljs-number">528</span>);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="21"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="22"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 2.监听客户端连接:等待客户端连接,一旦有客户端来连,会返回客户端的连接对象</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="23"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">Socket</span> <span class="hljs-variable">socket</span> <span class="hljs-operator">=</span> ss.accept();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="24"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="25"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 3.从连接管道中获取输入流读取数据</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="26"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">//        InputStream is = socket.getInputStream();</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="27"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 字符缓冲输入流                          字符输入转换流                字节输入流</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="28"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-type">BufferedReader</span> <span class="hljs-variable">br</span> <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">BufferedReader</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">InputStreamReader</span>(socket.getInputStream()));</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="29"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        String line;</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="30"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-keyword">while</span>((line = br.readLine()) != <span class="hljs-literal">null</span>){</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="31"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">            System.out.println(line);</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="32"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="33"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="34"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">      <span class="hljs-comment"><span class="hljs-comment">/*  int b;</span></span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="35"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">        while((b = br.read()) != -1){</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="36"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">            System.out.print((char)b);</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="37"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"><span class="hljs-comment">        }*/</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="38"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line"> </div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="39"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 4.释放资源</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="40"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 这行代码相当于断开了跟客户端之间的连接</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="41"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        socket.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="42"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        <span class="hljs-comment">// 关闭了服务器</span></div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="43"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">        ss.close();</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="44"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">    }</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="45"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">}</div></div></li></ol></code><div class="hide-preCode-box"><span class="hide-preCode-bt"><img class="look-more-preCode contentImg-no-view" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCodeMoreWhite.png" alt="" title=""></span></div><div class="hljs-button {2}" data-title="复制" onclick="hljs.copyCode(event)"></div></pre> 
<p><span style="background-color:#f9eda6;">先运行服务器端，再打开浏览器，输入本机IP以及端口号：</span></p> 
<p><img alt="" height="568" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/19e2aa66e18b440c8cd36858ffd348f9.png" width="1200"></p> 
<blockquote> 
 <p>总结：</p> 
 <ul><li><span style="background-color:#f9eda6;">在BS架构中客户端就是浏览器，而我们的服务端就是接收浏览器传递过来的数据</span>。</li><li>当我们要回写的时候，也是把数据回写给浏览器！</li></ul> 
</blockquote>
                </div><div><div></div></div>
        </div>
        <div id="treeSkill" style="display: block;"><div class="skill-tree-box"><div class="skill-tree-head">文章已被收录至官方知识档案</div><div class="skill-tree-body"><div class="skill-tree-item"><span class="skill-tree-href"><a data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.6707&quot;,&quot;dest&quot;:&quot;https://edu.csdn.net/skill/java/java-b99a081bd1e9444ba7793989c076b3b2?utm_source=csdn_ai_skill_tree_blog&quot;}" href="https://edu.csdn.net/skill/java/java-b99a081bd1e9444ba7793989c076b3b2?utm_source=csdn_ai_skill_tree_blog" target="_blank">Java技能树</a><i></i><a data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.6707&quot;,&quot;dest&quot;:&quot;https://edu.csdn.net/skill/java/java-b99a081bd1e9444ba7793989c076b3b2?utm_source=csdn_ai_skill_tree_blog&quot;}" href="https://edu.csdn.net/skill/java/java-b99a081bd1e9444ba7793989c076b3b2?utm_source=csdn_ai_skill_tree_blog" target="_blank">网络编程</a><i></i><a data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.6707&quot;,&quot;dest&quot;:&quot;https://edu.csdn.net/skill/java/java-b99a081bd1e9444ba7793989c076b3b2?utm_source=csdn_ai_skill_tree_blog&quot;}" href="https://edu.csdn.net/skill/java/java-b99a081bd1e9444ba7793989c076b3b2?utm_source=csdn_ai_skill_tree_blog" target="_blank">网络编程基础</a></span><span class="skill-tree-con"><span class="skill-tree-count">120062</span> 人正在系统学习中</span></div></div></div></div>
    </article>
<script>
  $(function() {
    setTimeout(function () {
      var mathcodeList = document.querySelectorAll('.htmledit_views img.mathcode');
      if (mathcodeList.length > 0) {
        for (let i = 0; i < mathcodeList.length; i++) {
          if (mathcodeList[i].naturalWidth === 0 || mathcodeList[i].naturalHeight === 0) {
            var alt = mathcodeList[i].alt;
            alt = '\\(' + alt + '\\)';
            var curSpan = $('<span class="img-codecogs"></span>');
            curSpan.text(alt);
            $(mathcodeList[i]).before(curSpan);
            $(mathcodeList[i]).remove();
          }
        }
        MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
      }
    }, 1000)
  });
</script>
</div>
    <div class="more-toolbox-new more-toolbox-active" id="toolBarBox">
      <div class="left-toolbox" style="position: fixed; z-index: 996; left: 344.333px; bottom: 0px; width: 1010px;">
        <div class="toolbox-left">
            <div class="profile-box">
              <a class="profile-href" target="_blank" href="https://blog.csdn.net/weixin_53622554"><img class="profile-img" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ef60164a8b2f481f98561d867bc0d251_weixin_53622554.jpg!1">
                <span class="profile-name">
                  Surpass余sheng军
                </span>
              </a>
            </div>
            <div class="profile-attend">
                <a class="tool-attend tool-bt-button tool-bt-attend" href="javascript:;">关注</a>
              <a class="tool-item-follow active-animation" style="display:none;">关注</a>
            </div>
        </div>
        <div class="toolbox-middle">
          <ul class="toolbox-list">
            <li class="tool-item tool-item-size tool-active is-like" id="is-like">
              <a class="tool-item-href">
                <img style="display:none;" id="is-like-imgactive-animation-like" class="animation-dom active-animation" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/tobarThumbUpactive.png" alt="">
                <img class="isactive" style="display:none" id="is-like-imgactive" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newHeart2021Active.png" alt="">
                <img class="isdefault" style="display:block" id="is-like-img" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newHeart2021Black.png" alt="">
                <span id="spanCount" class="count " style="color: rgb(153, 154, 170);">
                    1
                </span>
              </a>
              <div class="tool-hover-tip"><span class="text space">点赞</span></div>
            </li>
            <li class="tool-item tool-item-size tool-active is-unlike" id="is-unlike">
              <a class="tool-item-href">
                <img class="isactive" style="margin-right:0px;display:none" id="is-unlike-imgactive" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newUnHeart2021Active.png" alt="">
                <img class="isdefault" style="margin-right:0px;display:block" id="is-unlike-img" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newUnHeart2021Black.png" alt="">
                <span id="unlikeCount" class="count "></span>
              </a>
              <div class="tool-hover-tip"><span class="text space">踩</span></div>
            </li>
            <li class="tool-item tool-item-size tool-active is-collection ">
              <a class="tool-item-href" href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4130&quot;,&quot;ab&quot;:&quot;new&quot;}">
                <img style="display:none" id="is-collection-img-collection" class="animation-dom active-animation" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/tobarCollectionActive.png" alt="">
                <img class="isdefault" id="is-collection-img" style="display:block" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCollectBlack.png" alt="">
                <img class="isactive" id="is-collection-imgactive" style="display:none" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newCollectActive.png" alt="">
                <span class="count get-collection" id="get-collection" style="color: rgb(153, 154, 170);">
                    0
                </span>
              </a>
              <div class="tool-hover-tip collect">
                <div class="collect-operate-box">
                  <span class="collect-text" id="is-collection">
                    收藏
                  </span>
                </div>
              </div>
              <div class="tool-active-list">
                <div class="text">
                  觉得还不错?
                  <span class="collect-text" id="tool-active-list-collection">
                    一键收藏
                  </span>
                 <img id="tool-active-list-close" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/collectionCloseWhite.png" alt="">
                </div>
              </div>
            </li>
                <li class="tool-item tool-item-size tool-active tool-item-reward">
                  <a class="tool-item-href" href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_830&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4237&quot;,&quot;dest&quot;:&quot;&quot;,&quot;ab&quot;:&quot;new&quot;}">
                    <img class="isdefault reward-bt" id="rewardBtNew" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newRewardBlack.png" alt="打赏">
                    <span class="count" style="color: rgb(153, 154, 170);"></span>
                  </a>
                  <div class="tool-hover-tip"><span class="text space">打赏</span></div>
                </li>
          <li class="tool-item tool-item-size tool-active tool-item-comment">
            
              <a class="tool-item-href go-side-comment" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.7009&quot;}">
              <img class="isdefault" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newComment2021Black.png" alt="">
              <span class="count">0</span>
            </a>
            <div class="tool-hover-tip"><span class="text space">评论</span></div>
          </li>
          <li class="tool-item tool-item-bar">
          </li>
          <li class="tool-item tool-item-size tool-active tool-QRcode" data-type="article" id="tool-share">
            <a class="tool-item-href" href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;1582594662_002&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4129&quot;,&quot;ab&quot;:&quot;new&quot;}">
              <img class="isdefault" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newShareBlack.png" alt="">
            </a>
              <div class="QRcode" id="tool-QRcode">
            <div class="share-bg-icon icon1 icon4" id="shareBgIcon"></div>
              <div class="share-bg-box">
                <div class="share-content">
                    <img class="share-avatar" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ef60164a8b2f481f98561d867bc0d251_weixin_53622554.jpg!1" alt="">
                  <div class="share-tit">
                    Java网络编程
                  </div>
                  <div class="share-dec">
                    在网络通信协议下，不同计算机上运行的程序，进行的数据传输。
                  </div>
                  <a id="copyPosterUrl" class="url" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.7493&quot;}">复制链接</a>
                </div>
                <div class="share-code">
                  <div class="share-code-box" id="shareCode"><canvas width="65" height="65"></canvas><img style="display: none;"></div>
                  <div class="share-code-text">扫一扫</div>
                </div>
              </div>
                <div class="share-code-type"><p class="hot" data-type="hot"><span>热门</span></p><p class="vip" data-type="vip"><span>VIP</span></p></div>
            </div>
          </li>
        </ul>
      </div>
      <div class="toolbox-right">
            <div class="tool-directory">
                <a class="bt-columnlist-show" data-id="12195583" data-free="true" data-subscribe="false" data-title="Java" data-img="https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64" data-url="https://blog.csdn.net/weixin_53622554/category_12195583.html" data-sum="56" data-people="2" data-price="0" data-oldprice="0" data-join="false" data-studyvip="false" data-studysubscribe="false" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.6334&quot;,&quot;extend1&quot;:&quot;专栏目录&quot;}">专栏目录</a>
          </div>
</div>
</div>
</div>
<script type="text/javascript" crossorigin="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/qrcode-7c90a92189.min.js.下载"></script>
<script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/saved_resource(2)" type="text/javascript"></script>
<script type="text/javascript" crossorigin="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/csdn-login-box.js.下载"></script>
<script type="text/javascript" crossorigin="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/collection-box.js.下载"></script>                <div class="first-recommend-box recommend-box ">
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/qq_37002851/10267710">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/qq_37002851/10267710" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6661.1&quot;,&quot;mod&quot;:&quot;popu_871&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant_t0.none-task-download-2~default~OPENSEARCH~Paid-1-10267710-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;1&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Paid&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/qq_37002851/10267710&quot;}" data-report-query="spm=1001.2101.3001.6661.1&amp;utm_medium=distribute.pc_relevant_t0.none-task-download-2%7Edefault%7EOPENSEARCH%7EPaid-1-10267710-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant_t0.none-task-download-2%7Edefault%7EOPENSEARCH%7EPaid-1-10267710-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=1">
					<div class="left ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em></div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">03-03</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/qq_37002851/10267710" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6661.1&quot;,&quot;mod&quot;:&quot;popu_871&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant_t0.none-task-download-2~default~OPENSEARCH~Paid-1-10267710-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;1&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Paid&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/qq_37002851/10267710&quot;}" data-report-query="spm=1001.2101.3001.6661.1&amp;utm_medium=distribute.pc_relevant_t0.none-task-download-2%7Edefault%7EOPENSEARCH%7EPaid-1-10267710-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant_t0.none-task-download-2%7Edefault%7EOPENSEARCH%7EPaid-1-10267710-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=1">
				<div class="desc ellipsis-online ellipsis-online-1">对<em>java</em><em>网络编程</em>的进一步讲解，提升对<em>java</em><em>网络编程</em>的了解</div>
			</a>
		</div>
	</div>
</div>
                </div>
              <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/pc_wap_commontools-ad67eb7a7a.min.js.下载" type="text/javascript" async=""></script>
                <div class="second-recommend-box recommend-box ">
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/weixin_45709829/85639205">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/weixin_45709829/85639205" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.1&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-1-85639205-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;1&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/weixin_45709829/85639205&quot;}" data-report-query="spm=1001.2101.3001.6650.1&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-1-85639205-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-1-85639205-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=2">
					<div class="left ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em>http通信</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-14</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/weixin_45709829/85639205" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.1&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-1-85639205-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;1&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/weixin_45709829/85639205&quot;}" data-report-query="spm=1001.2101.3001.6650.1&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-1-85639205-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-1-85639205-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=2">
				<div class="desc ellipsis-online ellipsis-online-1">通过<em>java</em><em>网络编程</em>深入理解http非阻塞通信和阻塞通信，以及http协议在网络中的应用 源码包每一行都有注释，在代码里面每一个类都有详细的注释来解释这个类的功能这个方法的功能，调用哪一个类的哪一个功能等等。 压缩...</div>
			</a>
		</div>
	</div>
</div>
                </div>
<a id="commentBox" name="commentBox"></a>
<div id="pcCommentBox" class="comment-box comment-box-new2 login-comment-box-new comment-box-nostyle" style="display:none">
    <div class="has-comment" style="display: none;">
      <div class="one-line-box">
        <div class="has-comment-tit go-side-comment">
          <span class="count">0</span>&nbsp;条评论
        </div>
        <div class="has-comment-con comment-operate-item"></div>
        <a class="has-comment-bt-right go-side-comment focus">写评论</a>
      </div>
    </div>
</div>              <div class="recommend-box insert-baidu-box recommend-box-style ">
                <div class="recommend-item-box no-index" style="display:none"></div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/qq_28393611/12490565">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/qq_28393611/12490565" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.2&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-2-12490565-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;2&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/qq_28393611/12490565&quot;}" data-report-query="spm=1001.2101.3001.6650.2&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-2-12490565-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-2-12490565-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=3">
					<div class="left ellipsis-online ellipsis-online-1"><em>Java</em><em>网络编程</em>.ppt</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-02</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/qq_28393611/12490565" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.2&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-2-12490565-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;2&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/qq_28393611/12490565&quot;}" data-report-query="spm=1001.2101.3001.6650.2&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-2-12490565-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-2-12490565-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=3">
				<div class="desc ellipsis-online ellipsis-online-1">网络上计算机通过TCP/IP协议进行通信，而套接字（socket）则将这些通信协议进行了封装，如数据服务器，需要数据的客户端机器向数据服务器提出请求，而服务器则处理客户端的请求并向其发送所需的数据；</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/u010009945/10950234">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/u010009945/10950234" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.3&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-3-10950234-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;3&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/u010009945/10950234&quot;}" data-report-query="spm=1001.2101.3001.6650.3&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-3-10950234-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-3-10950234-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=4">
					<div class="left ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em>精讲</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">02-07</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/u010009945/10950234" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.3&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-3-10950234-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;3&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/u010009945/10950234&quot;}" data-report-query="spm=1001.2101.3001.6650.3&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-3-10950234-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-3-10950234-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=4">
				<div class="desc ellipsis-online ellipsis-online-1"><em>Java</em><em>网络编程</em>精讲，主要涉及Socket,ServerSocket,NIO,http协议，tcp，udp精讲等等</div>
			</a>
		</div>
	</div>
</div>
		
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/qq_34461126/10117413">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/qq_34461126/10117413" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.4&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-4-10117413-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;4&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/qq_34461126/10117413&quot;}" data-report-query="spm=1001.2101.3001.6650.4&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-4-10117413-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-4-10117413-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=5">
					<div class="left ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em>pdf</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">11-14</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/qq_34461126/10117413" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.4&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-4-10117413-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;4&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/qq_34461126/10117413&quot;}" data-report-query="spm=1001.2101.3001.6650.4&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-4-10117413-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-4-10117413-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=5">
				<div class="desc ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em>pdf <em>java</em><em>网络编程</em>pdf <em>java</em><em>网络编程</em>pdf <em>java</em><em>网络编程</em>pdf <em>java</em><em>网络编程</em>pdf <em>java</em><em>网络编程</em>pdf <em>java</em><em>网络编程</em>pdf <em>java</em><em>网络编程</em>pdf</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/cw3225654/10558295">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/cw3225654/10558295" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.5&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-5-10558295-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;5&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/cw3225654/10558295&quot;}" data-report-query="spm=1001.2101.3001.6650.5&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-5-10558295-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-5-10558295-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=6">
					<div class="left ellipsis-online ellipsis-online-1"><em>Java</em><em>网络编程</em>(第4版)PDF</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">07-23</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/cw3225654/10558295" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.5&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-5-10558295-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;5&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/cw3225654/10558295&quot;}" data-report-query="spm=1001.2101.3001.6650.5&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-5-10558295-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-5-10558295-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=6">
				<div class="desc ellipsis-online ellipsis-online-1"><em>Java</em><em>网络编程</em>(第4版)的电子版书籍，学习<em>java</em>通讯技术的同学建议看一下这本书</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/weixin_38719475/14943503">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/weixin_38719475/14943503" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.6&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-6-14943503-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;6&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/weixin_38719475/14943503&quot;}" data-report-query="spm=1001.2101.3001.6650.6&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-6-14943503-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-6-14943503-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=7">
					<div class="left ellipsis-online ellipsis-online-1"><em>Java</em><em>网络编程</em>总结</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">01-27</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/weixin_38719475/14943503" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.6&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-6-14943503-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;6&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/weixin_38719475/14943503&quot;}" data-report-query="spm=1001.2101.3001.6650.6&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-6-14943503-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-6-14943503-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=7">
				<div class="desc ellipsis-online ellipsis-online-1">而TCP层则提供面向应用的可靠（tcp）的或非可靠（UDP）的数据传输机制，这是<em>网络编程</em>的主要对象，一般不需要关心IP层是如何处理数据的。目前较为流行的<em>网络编程</em>模型是客户机/服务器（C/S）结构。即通信双方一方作为...</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/Ykprint/14021937">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/Ykprint/14021937" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.7&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-7-14021937-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;7&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/Ykprint/14021937&quot;}" data-report-query="spm=1001.2101.3001.6650.7&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-7-14021937-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-7-14021937-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=8">
					<div class="left ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em>高清pdf</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">01-04</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/Ykprint/14021937" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.7&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-7-14021937-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;7&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/Ykprint/14021937&quot;}" data-report-query="spm=1001.2101.3001.6650.7&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-7-14021937-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-7-14021937-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=8">
				<div class="desc ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em>高清pdf</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/aa46449521/10218934">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/aa46449521/10218934" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.8&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-8-10218934-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;8&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/aa46449521/10218934&quot;}" data-report-query="spm=1001.2101.3001.6650.8&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-8-10218934-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-8-10218934-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=9">
					<div class="left ellipsis-online ellipsis-online-1"><em>JAVA</em><em>网络编程</em>第4版</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">01-23</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/aa46449521/10218934" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.8&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-8-10218934-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;8&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/aa46449521/10218934&quot;}" data-report-query="spm=1001.2101.3001.6650.8&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-8-10218934-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-8-10218934-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=9">
				<div class="desc ellipsis-online ellipsis-online-1">《<em>Java</em><em>网络编程</em>(第4版)》全面介绍了如何使用<em>Java</em>开发网络程序。你将学习如何使用<em>Java</em>的网络类库既快速又轻松地完成常见的<em>网络编程</em>任务，如编写多线程服务器、加密通信、广播到本地网络，以及向服务器端程序提交数据...</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/weixin_26717737/19543766">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/weixin_26717737/19543766" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.9&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-9-19543766-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;9&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/weixin_26717737/19543766&quot;}" data-report-query="spm=1001.2101.3001.6650.9&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-9-19543766-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-9-19543766-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=10">
					<div class="left ellipsis-online ellipsis-online-1"><em>Java</em><em>网络编程</em>精讲</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-10</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/weixin_26717737/19543766" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.9&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-9-19543766-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;9&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/weixin_26717737/19543766&quot;}" data-report-query="spm=1001.2101.3001.6650.9&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-9-19543766-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-9-19543766-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=10">
				<div class="desc ellipsis-online ellipsis-online-1">本课程是《<em>Java</em>初级至应用》系统课程的第十一章，全套课程精细讲解，课程超过其他机构30%的课程量，经过我们全套课程系统学习的同学，可轻松从事<em>Java</em>工程师或系统架构师岗位，课程提供全套代码笔记其它相关素材及...</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/weixin_45709829/85639186">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/weixin_45709829/85639186" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.10&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-10-85639186-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;10&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/weixin_45709829/85639186&quot;}" data-report-query="spm=1001.2101.3001.6650.10&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-10-85639186-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-10-85639186-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=11">
					<div class="left ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em>TCP/IP协议</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-14</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/weixin_45709829/85639186" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.10&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~OPENSEARCH~Rate-10-85639186-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;10&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Rate&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/weixin_45709829/85639186&quot;}" data-report-query="spm=1001.2101.3001.6650.10&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-10-85639186-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EOPENSEARCH%7ERate-10-85639186-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=11">
				<div class="desc ellipsis-online ellipsis-online-1">通过<em>java</em><em>网络编程</em>初步理解TCP/IP协议 源码包每一行都有注释，在代码里面每一个类都有详细的注释来解释这个类的功能这个方法的功能，调用哪一个类的哪一个功能等等。 压缩包包含实验报告（实验原理、实验环境、实验...</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/zxlCoder/87892611">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/zxlCoder/87892611" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.11&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-11-87892611-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;11&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/zxlCoder/87892611&quot;}" data-report-query="spm=1001.2101.3001.6650.11&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-11-87892611-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-11-87892611-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=12">
					<div class="left ellipsis-online ellipsis-online-1">day04-常用API&amp;异常</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-11</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/zxlCoder/87892611" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.11&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-11-87892611-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;11&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/zxlCoder/87892611&quot;}" data-report-query="spm=1001.2101.3001.6650.11&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-11-87892611-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-11-87892611-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=12">
				<div class="desc ellipsis-online ellipsis-online-1">day04-常用API&amp;异常</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/2201_75292798/87891771">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/2201_75292798/87891771" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.12&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-12-87891771-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;12&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/2201_75292798/87891771&quot;}" data-report-query="spm=1001.2101.3001.6650.12&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-12-87891771-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-12-87891771-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=13">
					<div class="left ellipsis-online ellipsis-online-1">关于等差数列同等性质与性质的推广其及应用_数学等差数列论文毕业设计范文.pdf</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-10</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/2201_75292798/87891771" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.12&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-12-87891771-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;12&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/2201_75292798/87891771&quot;}" data-report-query="spm=1001.2101.3001.6650.12&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-12-87891771-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-12-87891771-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=13">
				<div class="desc ellipsis-online ellipsis-online-1">关于等差数列同等性质与性质的推广其及应用_数学等差数列论文毕业设计范文.pdf</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/m0_62211498/87893978">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/m0_62211498/87893978" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.13&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-13-87893978-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;13&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/m0_62211498/87893978&quot;}" data-report-query="spm=1001.2101.3001.6650.13&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-13-87893978-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-13-87893978-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=14">
					<div class="left ellipsis-online ellipsis-online-1">数据库系统概论实验报告合集</div>
					<div class="tag">最新发布</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-11</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/m0_62211498/87893978" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.13&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-13-87893978-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;13&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/m0_62211498/87893978&quot;}" data-report-query="spm=1001.2101.3001.6650.13&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-13-87893978-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-13-87893978-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=14">
				<div class="desc ellipsis-online ellipsis-online-1">学校实验报告</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/2201_75292798/87891804">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/2201_75292798/87891804" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.14&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-14-87891804-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;14&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/2201_75292798/87891804&quot;}" data-report-query="spm=1001.2101.3001.6650.14&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-14-87891804-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-14-87891804-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=15">
					<div class="left ellipsis-online ellipsis-online-1">便携式多功能心率监测仪__心率计设计_论文毕业设计范文.pdf</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-10</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/2201_75292798/87891804" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.14&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-14-87891804-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;14&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/2201_75292798/87891804&quot;}" data-report-query="spm=1001.2101.3001.6650.14&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-14-87891804-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-14-87891804-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=15">
				<div class="desc ellipsis-online ellipsis-online-1">便携式多功能心率监测仪__心率计设计_论文毕业设计范文.pdf</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/sinat_27305053/87892504">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/sinat_27305053/87892504" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.15&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-15-87892504-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;15&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/sinat_27305053/87892504&quot;}" data-report-query="spm=1001.2101.3001.6650.15&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-15-87892504-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-15-87892504-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=16">
					<div class="left ellipsis-online ellipsis-online-1">2004年下半年软件设计师下午真题（案例分析）含答案</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-10</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/sinat_27305053/87892504" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.15&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-15-87892504-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;15&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/sinat_27305053/87892504&quot;}" data-report-query="spm=1001.2101.3001.6650.15&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-15-87892504-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-15-87892504-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=16">
				<div class="desc ellipsis-online ellipsis-online-1">2004年下半年软件设计师下午真题（案例分析）</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_download clearfix" data-url="https://download.csdn.net/download/m0_38106923/87891181">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://download.csdn.net/download/m0_38106923/87891181" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.16&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-16-87891181-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;16&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/m0_38106923/87891181&quot;}" data-report-query="spm=1001.2101.3001.6650.16&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-16-87891181-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-16-87891181-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=17">
					<div class="left ellipsis-online ellipsis-online-1">基于<em>Java</em> SSM MySQL实现实现物流配送管理系统【优质毕业设计、课程设计项目】.zip</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">06-10</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://download.csdn.net/download/m0_38106923/87891181" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.16&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-download-2~default~BlogCommendHotData~default-16-87891181-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;16&quot;,&quot;strategy&quot;:&quot;2~default~BlogCommendHotData~default&quot;,&quot;dest&quot;:&quot;https://download.csdn.net/download/m0_38106923/87891181&quot;}" data-report-query="spm=1001.2101.3001.6650.16&amp;utm_medium=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-16-87891181-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-download-2%7Edefault%7EBlogCommendHotData%7Edefault-16-87891181-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=17">
				<div class="desc ellipsis-online ellipsis-online-1">优质毕业设计、课程设计项目，包括：程序源代码、数据库、配置环境说明，可完美运行。</div>
			</a>
		</div>
	</div>
</div>
<div class="recommend-item-box type_chatgpt clearfix" data-url="https://wenku.csdn.net/answer/cbc90c8222604bc79b705c9686a6e435">
	<div class="content-box">
		<div class="content-blog display-flex">
			<div class="title-box">
				<a href="https://wenku.csdn.net/answer/cbc90c8222604bc79b705c9686a6e435" class="tit" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.17&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-chatgpt-2~default~OPENSEARCH~Position-17-cbc90c8222604bc79b705c9686a6e435-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;17&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Position&quot;,&quot;dest&quot;:&quot;https://wenku.csdn.net/answer/cbc90c8222604bc79b705c9686a6e435&quot;}" data-report-query="spm=1001.2101.3001.6650.17&amp;utm_medium=distribute.pc_relevant.none-task-chatgpt-2%7Edefault%7EOPENSEARCH%7EPosition-17-cbc90c8222604bc79b705c9686a6e435-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-chatgpt-2%7Edefault%7EOPENSEARCH%7EPosition-17-cbc90c8222604bc79b705c9686a6e435-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=18">
					<div class="left ellipsis-online ellipsis-online-1"><em>java</em><em>网络编程</em>互相传输</div>
				</a>
			</div>
			<div class="info-box display-flex">
				<div class="info display-flex">
					<span class="info-block">03-27</span>
				</div>
			</div>
		</div>
		<div class="desc-box">
			<a href="https://wenku.csdn.net/answer/cbc90c8222604bc79b705c9686a6e435" target="_blank" data-report-click="{&quot;ab&quot;:&quot;new&quot;,&quot;spm&quot;:&quot;1001.2101.3001.6650.17&quot;,&quot;mod&quot;:&quot;popu_387&quot;,&quot;extra&quot;:&quot;{\&quot;highlightScore\&quot;:0.0,\&quot;utm_medium\&quot;:\&quot;distribute.pc_relevant.none-task-chatgpt-2~default~OPENSEARCH~Position-17-cbc90c8222604bc79b705c9686a6e435-blog-129883195.235^v38^pc_relevant_anti_t3\&quot;,\&quot;dist_request_id\&quot;:\&quot;1686562696428_39618\&quot;}&quot;,&quot;dist_request_id&quot;:&quot;1686562696428_39618&quot;,&quot;ab_strategy&quot;:&quot;increase_t0_download_v2&quot;,&quot;index&quot;:&quot;17&quot;,&quot;strategy&quot;:&quot;2~default~OPENSEARCH~Position&quot;,&quot;dest&quot;:&quot;https://wenku.csdn.net/answer/cbc90c8222604bc79b705c9686a6e435&quot;}" data-report-query="spm=1001.2101.3001.6650.17&amp;utm_medium=distribute.pc_relevant.none-task-chatgpt-2%7Edefault%7EOPENSEARCH%7EPosition-17-cbc90c8222604bc79b705c9686a6e435-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;depth_1-utm_source=distribute.pc_relevant.none-task-chatgpt-2%7Edefault%7EOPENSEARCH%7EPosition-17-cbc90c8222604bc79b705c9686a6e435-blog-129883195.235%5Ev38%5Epc_relevant_anti_t3&amp;utm_relevant_index=18">
				<div class="desc ellipsis-online ellipsis-online-1"><em>Java</em><em>网络编程</em>中，数据的传输可以通过网络套接字(Socket)来实现。在客户端和服务器之间建立连接后，可以通过输入流和输出流来实现数据的读取和写入。

例如，服务器可以创建一个ServerSocket对象，监听指定的端口，等待客户端的连接请求：

```<em>java</em>
ServerSocket serverSocket = new ServerSocket(8888);
Socket socket = serverSocket.accept(); // 监听客户端连接请求
```

而客户端可以创建一个Socket对象，连接到服务器指定的端口：

```<em>java</em>
Socket socket = new Socket("127.0.0.1", 8888);
```

在连接建立后，服务器和客户端可以通过输出流和输入流来互相传输数据，例如服务器可以通过以下代码向客户端发送一条消息：

```<em>java</em>
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
out.println("Hello, client!");
```

而客户端可以通过以下代码从服务器接收消息：

```<em>java</em>
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String message = in.readLine();
System.out.println("Received message from server: " + message);
```

这样，服务器和客户端就可以通过网络套接字实现数据的互相传输。</div>
			</a>
		</div>
	</div>
</div>
              </div>
<div id="recommendNps" class="recommend-nps-box common-nps-box" style="display: block;">
  <h3 class="aside-title">“相关推荐”对你有帮助么？</h3>
  <div class="aside-content">
      <ul class="newnps-list">
          <li class="newnps-item" data-type="非常没帮助">
              <div class="newnps-img-box">
                  <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel1.png" alt="">
                  <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey1.png" alt="">
              </div>
              <div class="newnps-text">非常没帮助</div>
          </li>
          <li class="newnps-item" data-type="没帮助">
              <div class="newnps-img-box">
                  <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel2.png" alt="">
                  <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey2.png" alt="">
              </div>
              <div class="newnps-text">没帮助</div>
          </li>
          <li class="newnps-item" data-type="一般">
              <div class="newnps-img-box">
                  <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel3.png" alt="">
                  <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey3.png" alt="">
              </div>
              <div class="newnps-text">一般</div>
          </li>
          <li class="newnps-item" data-type="有帮助">
              <div class="newnps-img-box">
                  <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel4.png" alt="">
                  <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey4.png" alt="">
              </div>
              <div class="newnps-text">有帮助</div>
          </li>
          <li class="newnps-item" data-type="非常有帮助">
              <div class="newnps-img-box">
                  <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel5.png" alt="">
                  <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey5.png" alt="">
              </div>
              <div class="newnps-text">非常有帮助</div>
          </li>
      </ul>
      <div class="newnps-form-box">
      <div class="newnps-form">
          <input type="text" placeholder="请输入建议或反馈后点击提交" class="newnps-input">
          <span class="newnps-btn">提交</span>
      </div>
      </div>
  </div>
</div><div class="blog-footer-bottom" style="margin-top:10px;">
        <div id="copyright-box" class="">
          <div id="csdn-copyright-footer" class="column small">
            <ul class="footer-column-t">
            <li>
              <a href="https://www.csdn.net/company/index.html#about" target="_blank">关于我们</a>
            </li>
            <li>
              <a href="https://www.csdn.net/company/index.html#recruit" target="_blank">招贤纳士</a>
            </li>
            <li><a href="https://marketing.csdn.net/questions/Q2202181741262323995" target="_blank">商务合作</a></li>
            <li><a href="https://marketing.csdn.net/questions/Q2202181748074189855" target="_blank">寻求报道</a></li>
            <li>
              <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/tel.png" alt="">
              <span>400-660-0108</span>
            </li>
            <li>
              <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/email.png" alt="">
              <a href="mailto:webmaster@csdn.net" target="_blank">kefu@csdn.net</a>
            </li>
            <li>
              <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/cs.png" alt="">
              <a href="https://csdn.s2.udesk.cn/im_client/?web_plugin_id=29181" target="_blank">在线客服</a>
            </li>
            <li>
              工作时间&nbsp;8:30-22:00
            </li>
          </ul>
            <ul class="footer-column-b">
            <li><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/badge.png" alt=""><a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010502030143" rel="noreferrer" target="_blank">公安备案号11010502030143</a></li>
            <li><a href="http://beian.miit.gov.cn/publish/query/indexFirst.action" rel="noreferrer" target="_blank">京ICP备19004658号</a></li>
            <li><a href="https://csdnimg.cn/release/live_fe/culture_license.png" rel="noreferrer" target="_blank">京网文〔2020〕1039-165号</a></li>
            <li><a href="https://csdnimg.cn/cdn/content-toolbar/csdn-ICP.png" target="_blank">经营性网站备案信息</a></li>
            <li><a href="http://www.bjjubao.org/" target="_blank">北京互联网违法和不良信息举报中心</a></li>
            <li><a href="https://download.csdn.net/tutelage/home" target="_blank">家长监护</a></li>
            <li><a href="http://www.cyberpolice.cn/" target="_blank">网络110报警服务</a></li>
            <li><a href="http://www.12377.cn/" target="_blank">中国互联网举报中心</a></li>
            <li><a href="https://chrome.google.com/webstore/detail/csdn%E5%BC%80%E5%8F%91%E8%80%85%E5%8A%A9%E6%89%8B/kfkdboecolemdjodhmhmcibjocfopejo?hl=zh-CN" target="_blank">Chrome商店下载</a></li>
            <li><a href="https://blog.csdn.net/blogdevteam/article/details/126135357" target="_blank">账号管理规范</a></li>
            <li><a href="https://www.csdn.net/company/index.html#statement" target="_blank">版权与免责声明</a></li>
            <li><a href="https://blog.csdn.net/blogdevteam/article/details/90369522" target="_blank">版权申诉</a></li>
            <li><a href="https://img-home.csdnimg.cn/images/20220705052819.png" target="_blank">出版物许可证</a></li>
            <li><a href="https://img-home.csdnimg.cn/images/20210414021142.jpg" target="_blank">营业执照</a></li>
            <li>©1999-2023北京创新乐知网络技术有限公司</li>
          </ul>
          </div>
        </div>
      </div>
<script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/csdn-footer.js.下载" data-isfootertrack="false" type="text/javascript"></script>
<script type="text/javascript">
    window.csdn.csdnFooter.options = {
        el: '.blog-footer-bottom',
        type: 2
    }
</script>          </main>
<aside class="blog_container_aside" style="position: fixed; bottom: 0px; z-index: 99; left: 36.3333px; width: 300px; top: auto;">
<div id="asideProfile" class="aside-box">
    <div class="profile-intro d-flex">
        <div class="avatar-box d-flex justify-content-center flex-column">
            <a href="https://blog.csdn.net/weixin_53622554" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4121&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554&quot;,&quot;ab&quot;:&quot;new&quot;}">
                <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ef60164a8b2f481f98561d867bc0d251_weixin_53622554.jpg!1" class="avatar_pic">
            </a>
        </div>
        <div class="user-info d-flex flex-column profile-intro-name-box">
            <div class="profile-intro-name-boxTop">
                <a href="https://blog.csdn.net/weixin_53622554" target="_blank" class="" id="uid" title="Surpass余sheng军" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4122&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554&quot;,&quot;ab&quot;:&quot;new&quot;}">
                    <span class="name " username="weixin_53622554">Surpass余sheng军</span>
                </a>
                <span>
                </span>
                <span class="flag expert-blog">
                <span class="bubble">CSDN认证博客专家</span>
                </span>
                <span class="flag company-blog">
                <span class="bubble">CSDN认证企业博客</span>
                </span>
            </div>
            <div class="profile-intro-name-boxFooter">
                <span class="personal-home-page personal-home-years" title="已加入 CSDN 2年">码龄2年</span>
                    <span class="personal-home-page">
                    <a class="personal-home-certification" href="https://i.csdn.net/#/uc/profile?utm_source=14998968" target="_blank" title="暂无认证">
                    <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/nocErtification.png" alt="">
                    暂无认证
                    </a>
                    </span>
            </div>
        </div>
    </div>
    <div class="data-info d-flex item-tiling">
        <dl class="text-center" title="118">
            <a href="https://blog.csdn.net/weixin_53622554" data-report-click="{&quot;mod&quot;:&quot;1598321000_001&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4310&quot;}" data-report-query="t=1">  
                <dt><span class="count">118</span></dt>
                <dd class="font">原创</dd>
            </a>
        </dl>
        <dl class="text-center" data-report-click="{&quot;mod&quot;:&quot;1598321000_002&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4311&quot;}" title="6931">
            <a href="https://blog.csdn.net/rank/list/weekly" target="_blank">
                <dt><span class="count">6931</span></dt>
                <dd class="font">周排名</dd>
            </a>
        </dl>
        <dl class="text-center" title="17394">
            <a href="https://blog.csdn.net/rank/list/total" data-report-click="{&quot;mod&quot;:&quot;1598321000_003&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4312&quot;}" target="_blank">
                <dt><span class="count">1万+</span></dt>
                <dd class="font">总排名</dd>
            </a>
        </dl>
        <dl class="text-center" style="min-width:58px" title="29244">  
            <dt><span class="count">2万+</span></dt>
            <dd>访问</dd>
        </dl>
        <dl class="text-center" title="4级,点击查看等级说明">
            <dt><a href="https://blog.csdn.net/blogdevteam/article/details/103478461" target="_blank">
                <img class="level" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/blog4.png">
            </a>
            </dt>
            <dd>等级</dd>
        </dl>
    </div>
    <div class="item-rank"></div>
    <div class="data-info d-flex item-tiling">
        <dl class="text-center" title="1218">
            <dt><span class="count">1218</span></dt>
            <dd>积分</dd>
        </dl>
         <dl class="text-center" id="fanBox" title="43">
            <dt><span class="count" id="fan">43</span></dt>
            <dd>粉丝</dd>
        </dl>
        <dl class="text-center" title="17">
            <dt><span class="count">17</span></dt>
            <dd>获赞</dd>
        </dl>
        <dl class="text-center" title="0">
            <dt><span class="count">0</span></dt>
            <dd>评论</dd>
        </dl>
        <dl class="text-center" title="57">
            <dt><span class="count">57</span></dt>
            <dd>收藏</dd>
        </dl>
    </div>
    <div class="aside-box-footer">
        <div class="badge-box d-flex">
            <div class="badge d-flex">
                <div class="icon-badge" title="习惯养成">
                    <div class="mouse-box">
                        <img class="medal-img" data-report-click="{&quot;spm&quot;:&quot;3001.4296&quot;}" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/xiguanyangchengLv1.png" alt="习惯养成">
                    </div>
                </div>
                <div class="icon-badge" title="新秀勋章">
                    <div class="mouse-box">
                        <img class="medal-img" data-report-click="{&quot;spm&quot;:&quot;3001.4296&quot;}" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/xinxiu@240.png" alt="新秀勋章">
                    </div>
                </div>
                <div class="icon-badge" title="持之以恒">
                    <div class="mouse-box">
                        <img class="medal-img" data-report-click="{&quot;spm&quot;:&quot;3001.4296&quot;}" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/346614c9e330420283031521f054f5f0.png" alt="持之以恒">
                    </div>
                </div>
                <div class="icon-badge" title="五一创作勋章">
                    <div class="mouse-box">
                        <img class="medal-img" data-report-click="{&quot;spm&quot;:&quot;3001.4296&quot;}" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/51_create.png" alt="五一创作勋章">
                    </div>
                </div>
                <div class="icon-badge" title="勤写标兵">
                    <div class="mouse-box">
                        <img class="medal-img" data-report-click="{&quot;spm&quot;:&quot;3001.4296&quot;}" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/69821f258b5d4570a32f9bcefda196aa.png" alt="勤写标兵">
                    </div>
                </div>
                <div class="icon-badge" title="笔耕不辍">
                    <div class="mouse-box">
                        <img class="medal-img" data-report-click="{&quot;spm&quot;:&quot;3001.4296&quot;}" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/70592b2299594e37aedcaa91fc52a294.png" alt="笔耕不辍">
                    </div>
                </div>
                <div class="icon-badge" title="创作能手">
                    <div class="mouse-box">
                        <img class="medal-img" data-report-click="{&quot;spm&quot;:&quot;3001.4296&quot;}" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/qixiebiaobing4@240.png" alt="创作能手">
                    </div>
                </div>
                <div class="icon-badge" title="阅读者勋章">
                    <div class="mouse-box">
                        <img class="medal-img" data-report-click="{&quot;spm&quot;:&quot;3001.4296&quot;}" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/yuedu7@240.png" alt="阅读者勋章">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="profile-intro-name-boxOpration">
        <div class="opt-letter-watch-box">
        <a class="bt-button personal-letter" href="https://im.csdn.net/chat/weixin_53622554" target="_blank" rel="noopener">私信</a>
        </div>
        <div class="opt-letter-watch-box"> 
            <a class="personal-watch bt-button" id="btnAttent">关注</a>  
        </div>
    </div>
</div>
 <div id="asideSearchArticle" class="aside-box">
	<div class="aside-content search-comter">
    <div class="aside-search aside-search-blog">         
        <input type="text" class="input-serch-blog" name="" autocomplete="off" value="" id="search-blog-words" placeholder="搜博主文章">
        <a class="btn-search-blog" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.9182&quot;}">
                    <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/csdn-sou.png">
        </a>
    </div>
    </div>
</div>


<div id="asideHotArticle" class="aside-box">
	<h3 class="aside-title">热门文章</h3>
	<div class="aside-content">
		<ul class="hotArticle-list">
			<li>
				<a href="https://blog.csdn.net/weixin_53622554/article/details/130537055" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/130537055&quot;,&quot;ab&quot;:&quot;new&quot;}">
				MySQL --- DML
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/readCountWhite.png" alt="">
					<span class="read">1164</span>
                </a>
			</li>
			<li>
				<a href="https://blog.csdn.net/weixin_53622554/article/details/130805570" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/130805570&quot;,&quot;ab&quot;:&quot;new&quot;}">
				Linux学习笔记 --- 初识Linux
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/readCountWhite.png" alt="">
					<span class="read">1050</span>
                </a>
			</li>
			<li>
				<a href="https://blog.csdn.net/weixin_53622554/article/details/130432324" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/130432324&quot;,&quot;ab&quot;:&quot;new&quot;}">
				日志技术-Logback
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/readCountWhite.png" alt="">
					<span class="read">1002</span>
                </a>
			</li>
			<li>
				<a href="https://blog.csdn.net/weixin_53622554/article/details/130874114" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/130874114&quot;,&quot;ab&quot;:&quot;new&quot;}">
				Linux学习笔记 --- Linux基础命令Part2
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/readCountWhite.png" alt="">
					<span class="read">865</span>
                </a>
			</li>
			<li>
				<a href="https://blog.csdn.net/weixin_53622554/article/details/130411272" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_541&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4139&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/130411272&quot;,&quot;ab&quot;:&quot;new&quot;}">
				原码、反码、补码
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/readCountWhite.png" alt="">
					<span class="read">844</span>
                </a>
			</li>
		</ul>
	</div>
</div>
<div id="asideCategory" class="aside-box ">
    <h3 class="aside-title">分类专栏</h3>
    <div class="aside-content">
        <ul>
            <li>
                <a class="clearfix special-column-name" target="_blank" href="https://blog.csdn.net/weixin_53622554/category_12195583.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/category_12195583.html&quot;,&quot;ab&quot;:&quot;new&quot;}">
                    <div class="special-column-bar "></div>
                    <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20201014180756927.png" alt="" onerror="this.src=&#39;https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64&#39;">
                    <span class="title oneline">
                        Java
                    </span>
                </a>
                <span class="special-column-num">56篇</span>
            </li>
            <li>
                <a class="clearfix special-column-name" target="_blank" href="https://blog.csdn.net/weixin_53622554/category_12112875.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/category_12112875.html&quot;,&quot;ab&quot;:&quot;new&quot;}">
                    <div class="special-column-bar "></div>
                    <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20201014180756780.png" alt="" onerror="this.src=&#39;https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64&#39;">
                    <span class="title oneline">
                        操作系统
                    </span>
                </a>
                <span class="special-column-num">6篇</span>
            </li>
        </ul>
    </div>
</div>
<div id="asideNewComments" class="aside-box">
    <h3 class="aside-title">最新评论</h3>
    <div class="aside-content">
        <ul class="newcomment-list">
            <li>
                <a class="title text-truncate" target="_blank" href="https://blog.csdn.net/weixin_53622554/article/details/130669438#comments_26563032" data-report-click="{&quot;mod&quot;:&quot;popu_542&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4231&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/130669438#comments_26563032&quot;,&quot;ab&quot;:&quot;new&quot;}">MyBatis入门</a>
                <p class="comment ellipsis">
                    <a href="https://blog.csdn.net/community_717" class="user-name" target="_blank">CSDN-Ada助手: </a>
                    <span class="code-comments">一定要坚持创作更多高质量博客哦, 小小红包, 以资鼓励, 
更多创作活动请看:
新星计划2023: https://marketing.csdn.net/p/1738cda78d47b2ebb920916aab7c3584?utm_source=csdn_ai_ada_redpacket
	新星计划2023: https://marketing.csdn.net/p/1738cda78d47b2ebb920916aab7c3584?utm_source=csdn_ai_ada_redpacket
	上传ChatGPT/计算机论文等资源，瓜分￥5000元现金: https://blog.csdn.net/VIP_Assistant/article/details/130196121?utm_source=csdn_ai_ada_redpacket
	新人首创任务挑战赛: https://marketing.csdn.net/p/90a06697f3eae83aabea1e150f5be8a5?utm_source=csdn_ai_ada_redpacket
	Microsoft Edge功能测评！: https://activity.csdn.net/creatActivity?id=10403?utm_source=csdn_ai_ada_redpacket
	职场解惑讨论会: https://activity.csdn.net/creatActivity?id=10427?utm_source=csdn_ai_ada_redpacket
	可持续能源技术真的能改变世界吗？: https://activity.csdn.net/creatActivity?id=10425?utm_source=csdn_ai_ada_redpacket
	无效数据，你会怎么处理？: https://activity.csdn.net/creatActivity?id=10423?utm_source=csdn_ai_ada_redpacket
	物联网技术正在如何影响我们的生活: https://activity.csdn.net/creatActivity?id=10421?utm_source=csdn_ai_ada_redpacket
	生物识别技术能否成为应对安全挑战的绝佳选择？: https://activity.csdn.net/creatActivity?id=10411?utm_source=csdn_ai_ada_redpacket
	应届生如何提高职场竞争力: https://activity.csdn.net/creatActivity?id=10409?utm_source=csdn_ai_ada_redpacket
	讯飞星火大模型将超越chatgpt？: https://activity.csdn.net/creatActivity?id=10407?utm_source=csdn_ai_ada_redpacket
	职场新人备忘录: https://activity.csdn.net/creatActivity?id=10405?utm_source=csdn_ai_ada_redpacket
	“裸奔”时代下该如何保护网络隐私: https://activity.csdn.net/creatActivity?id=10401?utm_source=csdn_ai_ada_redpacket
	VR vs AR：哪种技术更有潜力改变未来？: https://activity.csdn.net/creatActivity?id=10399?utm_source=csdn_ai_ada_redpacket
	蓝桥杯备赛指南分享: https://activity.csdn.net/creatActivity?id=10317?utm_source=csdn_ai_ada_redpacket
</span>
                </p>
            </li>
        </ul>
    </div>
</div>
<div id="asideNewNps" class="aside-box common-nps-box" style="display: block;">
    <h3 class="aside-title">您愿意向朋友推荐“博客详情页”吗？</h3>
    <div class="aside-content">
        <ul class="newnps-list">
            <li class="newnps-item" data-type="强烈不推荐">
                <div class="newnps-img-box">
                    <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel1.png" alt="">
                    <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey1.png" alt="">
                </div>
                <div class="newnps-text">强烈不推荐</div>
            </li>
            <li class="newnps-item" data-type="不推荐">
                <div class="newnps-img-box">
                    <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel2.png" alt="">
                    <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey2.png" alt="">
                </div>
                <div class="newnps-text">不推荐</div>
            </li>
            <li class="newnps-item" data-type="一般般">
                <div class="newnps-img-box">
                    <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel3.png" alt="">
                    <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey3.png" alt="">
                </div>
                <div class="newnps-text">一般般</div>
            </li>
            <li class="newnps-item" data-type="推荐">
                <div class="newnps-img-box">
                    <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel4.png" alt="">
                    <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey4.png" alt="">
                </div>
                <div class="newnps-text">推荐</div>
            </li>
            <li class="newnps-item" data-type="强烈推荐">
                <div class="newnps-img-box">
                    <img class="newnps-img active" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeel5.png" alt="">
                    <img class="newnps-img default" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/npsFeelGrey5.png" alt="">
                </div>
                <div class="newnps-text">强烈推荐</div>
            </li>
        </ul>
        <div class="newnps-form-box">
        <div class="newnps-form">
            <input type="text" placeholder="请输入建议或反馈后点击提交" class="newnps-input">
            <span class="newnps-btn">提交</span>
        </div>
        </div>
    </div>
</div>
<div id="asideArchive" class="aside-box" style="display:block!important; width:300px;">
    <h3 class="aside-title">最新文章</h3>
    <div class="aside-content">
        <ul class="inf_list clearfix">
            <li class="clearfix">
            <a href="https://blog.csdn.net/weixin_53622554/article/details/131145676" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/131145676&quot;,&quot;ab&quot;:&quot;new&quot;}">[命令行终端输入jps查不到进程ID]解决指南</a>
            </li>
            <li class="clearfix">
            <a href="https://blog.csdn.net/weixin_53622554/article/details/131049481" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/131049481&quot;,&quot;ab&quot;:&quot;new&quot;}">JVM调优</a>
            </li>
            <li class="clearfix">
            <a href="https://blog.csdn.net/weixin_53622554/article/details/130964264" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_382&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4136&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/article/details/130964264&quot;,&quot;ab&quot;:&quot;new&quot;}">MySQL存储引擎</a>
            </li>
        </ul>
        <div class="archive-bar"></div>
        <div class="archive-box">
                <div class="archive-title">2023</div> 
                <div class="archive-content">
                    <div class="archive-item">
                        <a href="https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=06" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_538&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4138&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=06&quot;}">
                        <span class="time">06月</span>
                        <span class="count">2篇</span>
                        </a>
                    </div>
                    <div class="archive-item">
                        <a href="https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=05" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_538&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4138&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=05&quot;}">
                        <span class="time">05月</span>
                        <span class="count">26篇</span>
                        </a>
                    </div>
                    <div class="archive-item">
                        <a href="https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=04" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_538&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4138&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=04&quot;}">
                        <span class="time">04月</span>
                        <span class="count">23篇</span>
                        </a>
                    </div>
                    <div class="archive-item">
                        <a href="https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=03" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_538&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4138&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=03&quot;}">
                        <span class="time">03月</span>
                        <span class="count">26篇</span>
                        </a>
                    </div>
                    <div class="archive-item">
                        <a href="https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=02" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_538&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4138&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=02&quot;}">
                        <span class="time">02月</span>
                        <span class="count">26篇</span>
                        </a>
                    </div>
                    <div class="archive-item">
                        <a href="https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=01" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_538&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4138&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2023&amp;month=01&quot;}">
                        <span class="time">01月</span>
                        <span class="count">8篇</span>
                        </a>
                    </div>
                </div>
                <div class="archive-list-item"><a href="https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2022&amp;month=11" target="_blank" data-report-click="{&quot;mod&quot;:&quot;popu_538&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4138&quot;,&quot;ab&quot;:&quot;new&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554?type=blog&amp;year=2022&amp;month=11&quot;}"><span class="year">2022年</span><span class="num">7篇</span></a></div>
        </div>
    </div>
</div>
	<div id="footerRightAds" class="isShowFooterAds">
		<div class="aside-box">
			<div id="kp_box_57" data-pid="57"><script async="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/f(7).txt" crossorigin="anonymous" data-checked-head="true"></script>
<!-- PC-博客-详情页-左下视窗-50-99 -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-1076724771190722" data-ad-slot="7418711749" data-ad-format="auto" data-full-width-responsive="true" data-adsbygoogle-status="done"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?p=57&amp;adId=1031240&amp;adBlockFlag=0&amp;a=1031240&amp;c=0&amp;k=Java网络编程&amp;spm=1001.2101.3001.5001&amp;articleId=129883195&amp;d=1&amp;t=3&amp;u=e5c0ff7828f1416fa102a4e436c0fbe4" style="display: block;width: 0px;height: 0px;"></div>
		</div>
	</div>
    <!-- 详情页显示目录 -->
<!--文章目录-->
<div id="asidedirectory" class="aside-box">
    <div class="groupfile" id="directory">
        <h3 class="aside-title">目录</h3>
        <div class="align-items-stretch group_item">
            <div class="pos-box">
            <div class="scroll-box">
                <div class="toc-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t0">一. 网络编程概述</a></li><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t1">计算机网络</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t2">什么是网络编程？</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t3">网络编程的应用场景：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t4">常见的软件架构</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t5">1.&nbsp;B/S架构：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t6">2. C/S架构：</a></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t7">二. 网络编程三要素</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t8">1. IP</a></li><li class="sub-box"><ol><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t10">IPv4</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t12">IPv4差不多能表示43亿个IP，为了解决IP不够用的问题，所以才出现了IPv6，这样就解决了网络地址资源数量不够的问题</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t13">IPv6</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t14">IPv4的一些小细节</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t15">IPv4的地址分类形式</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t16">常见的CMD命令</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t17">InetAddress类的使用：该类表示Internet协议 / IP地址。</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t18">端口号：应用程序在设备中唯一的标识。</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t19">协议：数据传输的规则</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t20">OSI参考模型</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t21">TCP/IP参考模型</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t22">UDP协议(用户数据报协议)</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t23">UDP协议的应用场景：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t24">TCP协议(传输控制协议)</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t25">TCP协议的应用场景：</a></li></ol></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t26">三. UDP通信程序</a></li><li class="sub-box"><ol><li class="active"><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t27">3.1 UDP协议发送数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t28">3.2 UDP协议接收数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t29">3.3 UDP练习-聊天室</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t30">发送端代码实现：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t31">接收端代码实现：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t32">允许这个类可以重复的运行多次：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t33">&nbsp;</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t34">3.4 UDP的三种通信方式：单播、组播、广播</a></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t35">四. TCP通信程序</a></li><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t36">客户端代码：利用TCP协议，去发送数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t37">服务器端代码：利用TCP协议，接收数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t38">TCP代码细节：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t39">TCP通信程序的综合练习：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t40">练习三：上传练习（TCP协议）</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t41">多线程 ，线程池版的服务端： &nbsp;</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t42">BS架构模型：BS架构不需要不需要开发客户端，只需要开发服务器即可！</a></li></ol></li></ol></div>
            </div>
            </div>
        </div>
    </div>
</div>
</aside>
<script>
	$("a.flexible-btn").click(function(){
		$(this).parents('div.aside-box').removeClass('flexible-box');
		$(this).parents("p.text-center").remove();
	})
</script>
<script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-tooltip.js.下载"></script>
<script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-medal.js.下载"></script>        </div>
<div class="recommend-right align-items-stretch clearfix" id="rightAside" data-type="recommend" style="height: auto !important;">
    <aside class="recommend-right_aside" style="height: auto !important;">
        <div id="recommend-right" style="position: fixed; top: 56px;">
                                <div class="programmer1Box">
                        <div id="kp_box_530" data-pid="530"><script async="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/f(7).txt" crossorigin="anonymous" data-checked-head="true"></script>
<!-- PC-博客-详情页-右上视窗-50-99 -->
<ins class="adsbygoogle" style="display: block; height: 600px;" data-ad-client="ca-pub-1076724771190722" data-ad-slot="1041005650" data-ad-format="auto" data-full-width-responsive="true" data-adsbygoogle-status="done" data-ad-status="filled"><div id="aswift_1_host" style="border: none; height: 600px; width: 300px; margin: 0px; padding: 0px; position: relative; visibility: visible; background-color: transparent; display: inline-block; overflow: visible;" tabindex="0" title="Advertisement" aria-label="Advertisement"><iframe id="aswift_1" name="aswift_1" style="left:0;position:absolute;top:0;border:0;width:300px;height:600px;" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" width="300" height="600" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ads.html" data-google-container-id="a!2" data-google-query-id="CNfp6dO3vf8CFVQMXAodHYYK9w" data-load-complete="true"></iframe></div></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?p=530&amp;adId=1031239&amp;adBlockFlag=0&amp;a=1031239&amp;c=0&amp;k=Java网络编程&amp;spm=1001.2101.3001.4647&amp;articleId=129883195&amp;d=1&amp;t=3&amp;u=1aa25beb4bc04cca90a87bed2dc1bf25" style="display: block;width: 0px;height: 0px;" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/1.png"></div>
                    </div>
            <div class="flex-column aside-box groupfile" id="groupfile" style="display: block; max-height: 458px;">
                <div class="groupfile-div" style="max-height: 458px;">
                <h3 class="aside-title">目录</h3>
                <div class="align-items-stretch group_item">
                    <div class="pos-box">
                        <div class="scroll-box">
                            <div class="toc-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t0">一. 网络编程概述</a></li><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t1">计算机网络</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t2">什么是网络编程？</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t3">网络编程的应用场景：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t4">常见的软件架构</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t5">1.&nbsp;B/S架构：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t6">2. C/S架构：</a></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t7">二. 网络编程三要素</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t8">1. IP</a></li><li class="sub-box"><ol><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t10">IPv4</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t12">IPv4差不多能表示43亿个IP，为了解决IP不够用的问题，所以才出现了IPv6，这样就解决了网络地址资源数量不够的问题</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t13">IPv6</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t14">IPv4的一些小细节</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t15">IPv4的地址分类形式</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t16">常见的CMD命令</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t17">InetAddress类的使用：该类表示Internet协议 / IP地址。</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t18">端口号：应用程序在设备中唯一的标识。</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t19">协议：数据传输的规则</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t20">OSI参考模型</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t21">TCP/IP参考模型</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t22">UDP协议(用户数据报协议)</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t23">UDP协议的应用场景：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t24">TCP协议(传输控制协议)</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t25">TCP协议的应用场景：</a></li></ol></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t26">三. UDP通信程序</a></li><li class="sub-box"><ol><li class="active"><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t27">3.1 UDP协议发送数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t28">3.2 UDP协议接收数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t29">3.3 UDP练习-聊天室</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t30">发送端代码实现：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t31">接收端代码实现：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t32">允许这个类可以重复的运行多次：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t33">&nbsp;</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t34">3.4 UDP的三种通信方式：单播、组播、广播</a></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t35">四. TCP通信程序</a></li><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t36">客户端代码：利用TCP协议，去发送数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t37">服务器端代码：利用TCP协议，接收数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t38">TCP代码细节：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t39">TCP通信程序的综合练习：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t40">练习三：上传练习（TCP协议）</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t41">多线程 ，线程池版的服务端： &nbsp;</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t42">BS架构模型：BS架构不需要不需要开发客户端，只需要开发服务器即可！</a></li></ol></li></ol></div>
                        </div>
                    </div>
                </div>
                </div>
            </div>
            <div class="aside-box kind_person d-flex flex-column">
                    <h3 class="aside-title">分类专栏</h3>
                    <div class="align-items-stretch kindof_item" id="kind_person_column">
                        <div class="aside-content">
                            <ul>
                                <li>
                                    <a class="clearfix special-column-name" target="_blank" href="https://blog.csdn.net/weixin_53622554/category_12195583.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/category_12195583.html&quot;,&quot;ab&quot;:&quot;new&quot;}">
                                        <div class="special-column-bar "></div>
                                        <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20201014180756927.png" alt="" onerror="this.src=&#39;https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64&#39;">
                                        <span class="">
                                            Java
                                        </span>
                                    </a>
                                    <span class="special-column-num">56篇</span>
                                </li>
                                <li>
                                    <a class="clearfix special-column-name" target="_blank" href="https://blog.csdn.net/weixin_53622554/category_12112875.html" data-report-click="{&quot;mod&quot;:&quot;popu_537&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4137&quot;,&quot;strategy&quot;:&quot;pc付费专栏左侧入口&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554/category_12112875.html&quot;,&quot;ab&quot;:&quot;new&quot;}">
                                        <div class="special-column-bar "></div>
                                        <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/20201014180756780.png" alt="" onerror="this.src=&#39;https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64&#39;">
                                        <span class="">
                                            操作系统
                                        </span>
                                    </a>
                                    <span class="special-column-num">6篇</span>
                                </li>
                            </ul>
                        </div>
                    </div>
            </div>
        </div>
    </aside>
</div>

<div class="recommend-right1  align-items-stretch clearfix" id="rightAsideConcision" data-type="recommend">
    <aside class="recommend-right_aside">
        <div id="recommend-right-concision" style="position: fixed; top: 56px;">
            <div class="flex-column aside-box groupfile" id="groupfileConcision">
                <div class="groupfile-div1" style="max-height: 868px;">
                <h3 class="aside-title">目录</h3>
                <div class="align-items-stretch group_item">
                    <div class="pos-box">
                        <div class="scroll-box">
                            <div class="toc-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t0">一. 网络编程概述</a></li><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t1">计算机网络</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t2">什么是网络编程？</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t3">网络编程的应用场景：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t4">常见的软件架构</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t5">1.&nbsp;B/S架构：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t6">2. C/S架构：</a></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t7">二. 网络编程三要素</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t8">1. IP</a></li><li class="sub-box"><ol><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t10">IPv4</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t12">IPv4差不多能表示43亿个IP，为了解决IP不够用的问题，所以才出现了IPv6，这样就解决了网络地址资源数量不够的问题</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t13">IPv6</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t14">IPv4的一些小细节</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t15">IPv4的地址分类形式</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t16">常见的CMD命令</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t17">InetAddress类的使用：该类表示Internet协议 / IP地址。</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t18">端口号：应用程序在设备中唯一的标识。</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t19">协议：数据传输的规则</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t20">OSI参考模型</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t21">TCP/IP参考模型</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t22">UDP协议(用户数据报协议)</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t23">UDP协议的应用场景：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t24">TCP协议(传输控制协议)</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t25">TCP协议的应用场景：</a></li></ol></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t26">三. UDP通信程序</a></li><li class="sub-box"><ol><li class="active"><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t27">3.1 UDP协议发送数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t28">3.2 UDP协议接收数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t29">3.3 UDP练习-聊天室</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t30">发送端代码实现：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t31">接收端代码实现：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t32">允许这个类可以重复的运行多次：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t33">&nbsp;</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t34">3.4 UDP的三种通信方式：单播、组播、广播</a></li></ol></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t35">四. TCP通信程序</a></li><li class="sub-box"><ol><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t36">客户端代码：利用TCP协议，去发送数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t37">服务器端代码：利用TCP协议，接收数据</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t38">TCP代码细节：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t39">TCP通信程序的综合练习：</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t40">练习三：上传练习（TCP协议）</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t41">多线程 ，线程池版的服务端： &nbsp;</a></li><li class=""><a href="https://blog.csdn.net/weixin_53622554/article/details/129883195#t42">BS架构模型：BS架构不需要不需要开发客户端，只需要开发服务器即可！</a></li></ol></li></ol></div>
                        </div>
                    </div>
                </div>
                </div>
            </div>
        </div>
    </aside>
</div>

      </div>
      <div class="mask-dark"></div>
      <div class="skin-boxshadow"></div>
      <div class="directory-boxshadow"></div>
<div class="comment-side-box-shadow comment-side-tit-close" id="commentSideBoxshadow">
<div class="comment-side-content">
	<div class="comment-side-tit">
		<span class="comment-side-tit-count">评论</span>	
	<img class="comment-side-tit-close" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/closeBt.png"></div>
	<div id="pcCommentSideBox" class="comment-box comment-box-new2 " style="display:block">
		<div class="comment-edit-box d-flex">
			<div class="user-img">
				<a href="https://blog.csdn.net/u013421039" target="_blank">
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/default.jpg!1">
				</a>
			</div>
			<form id="commentform">
				<textarea class="comment-content" name="comment_content" id="comment_content" placeholder="欢迎高质量的评论，低质的评论会被折叠" maxlength="1000"></textarea>
				<div class="comment-reward-box" style="background-image: url(&#39;https://img-home.csdnimg.cn/images/20230131025301.png&#39;);">
          <a class="btn-remove-reward"></a>
          <div class="form-reward-box">
            <div class="info">
              成就一亿技术人!
            </div>
            <div class="price-info">
              拼手气红包<span class="price">6.0元</span>
            </div>
          </div>
        </div>
        <div class="comment-operate-box">
					<div class="comment-operate-l">
						<span id="tip_comment" class="tip">还能输入<em>1000</em>个字符</span>
					</div>
					<div class="comment-operate-c">
						&nbsp;
					</div>
					<div class="comment-operate-r">
            <div class="comment-operate-item comment-reward">
							<img class="comment-operate-img" data-url="https://csdnimg.cn/release/blogv2/dist/pc/img/" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/commentReward.png" alt="红包">
							<span class="comment-operate-tip">添加红包</span>
						</div>
						<div class="comment-operate-item comment-emoticon">
							<img class="comment-operate-img" data-url="https://csdnimg.cn/release/blogv2/dist/pc/img/" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/commentEmotionIcon.png" alt="表情包">
							<span class="comment-operate-tip">插入表情</span>
							<div class="comment-emoticon-box comment-operate-isshow" style="display: none;">
								<div class="comment-emoticon-img-box"></div>
							</div>
						</div>
						<div class="comment-operate-item comment-code">
							<img class="comment-operate-img" data-url="https://csdnimg.cn/release/blogv2/dist/pc/img/" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/commentCodeIcon.png" alt="表情包">
							<span class="comment-operate-tip">代码片</span>
							<div class="comment-code-box comment-operate-isshow" style="display: none;">
								<ul id="commentCode">
									<li><a data-code="html">HTML/XML</a></li>
									<li><a data-code="objc">objective-c</a></li>
									<li><a data-code="ruby">Ruby</a></li>
									<li><a data-code="php">PHP</a></li>
									<li><a data-code="csharp">C</a></li>
									<li><a data-code="cpp">C++</a></li>
									<li><a data-code="javascript">JavaScript</a></li>
									<li><a data-code="python">Python</a></li>
									<li><a data-code="java">Java</a></li>
									<li><a data-code="css">CSS</a></li>
									<li><a data-code="sql">SQL</a></li>
									<li><a data-code="plain">其它</a></li>
								</ul>
							</div>
						</div>
						<div class="comment-operate-item">
							<input type="hidden" id="comment_replyId" name="comment_replyId">
							<input type="hidden" id="article_id" name="article_id" value="129883195">
							<input type="hidden" id="comment_userId" name="comment_userId" value="">
							<input type="hidden" id="commentId" name="commentId" value="">
							<a data-report-click="{&quot;mod&quot;:&quot;1582594662_003&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4227&quot;,&quot;ab&quot;:&quot;new&quot;}">
							<input type="submit" class="btn-comment btn-comment-input" value="评论">
							</a>
						</div>
					</div>
				</div>
			</form>
		</div>
		<div class="comment-list-container">
			<div class="comment-list-box comment-operate-item">
			</div>
			<div id="lookFlodComment" class="look-flod-comment" style="display: none;">
					<span class="count">0</span>&nbsp;条评论被折叠&nbsp;<a class="look-more-flodcomment">查看</a>
			</div>
			
		</div>
	</div>
	<div id="pcFlodCommentSideBox" class="pc-flodcomment-sidebox">
		<div class="comment-fold-tit"><span id="lookUnFlodComment" class="back"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/commentArrowLeftWhite.png" alt=""></span>被折叠的&nbsp;<span class="count">0</span>&nbsp;条评论
		 <a href="https://blogdev.blog.csdn.net/article/details/122245662" class="tip" target="_blank">为什么被折叠?</a>
		 <a href="https://bbs.csdn.net/forums/FreeZone" class="park" target="_blank">
		 <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconPark.png">到【灌水乐园】发言</a>                                
		</div>
		<div class="comment-fold-content"></div>
		<div id="lookBadComment" class="look-bad-comment side-look-comment">
			<a class="look-more-comment">查看更多评论<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/commentArrowDownWhite.png" alt=""></a>
		</div>
	</div>
</div>
<div class="comment-rewarddialog-box">
  <div class="form-box">
    <div class="title-box">
      添加红包
      <a class="btn-form-close"></a>
    </div>
    <form id="commentRewardForm">
      <div class="ipt-box">
        <label for="txtName">祝福语</label>
        <div class="ipt-btn-box">
          <input type="text" name="name" id="txtName" autocomplete="off" maxlength="50">
          <a class="btn-ipt btn-random"></a>
        </div>
        <p class="notice">请填写红包祝福语或标题</p>
      </div>
      <div class="ipt-box">
        <label for="txtSendAmount">红包数量</label>
        <div class="ipt-txt-box">
          <input type="text" name="sendAmount" maxlength="4" id="txtSendAmount" placeholder="请填写红包数量(最小10个)" autocomplete="off">
          <span class="after-txt">个</span>
        </div>
        <p class="notice">红包个数最小为10个</p>
      </div>
      <div class="ipt-box">
        <label for="txtMoney">红包总金额</label>
        <div class="ipt-txt-box error">
          <input type="text" name="money" maxlength="5" id="txtMoney" placeholder="请填写总金额(最低5元)" autocomplete="off">
          <span class="after-txt">元</span>
        </div>
        <p class="notice">红包金额最低5元</p>
      </div>
      <div class="balance-info-box">
        <label>余额支付</label>
        <div class="balance-info">
          当前余额<span class="balance">3.43</span>元
          <a href="https://i.csdn.net/#/wallet/balance/recharge" class="link-charge" target="_blank">前往充值 &gt;</a>
        </div>
      </div>
      <div class="opt-box">
        <div class="pay-info">
          需支付：<span class="price">10.00</span>元
        </div>
        <button type="button" class="ml-auto btn-cancel">取消</button>
        <button type="button" class="ml8 btn-submit" disabled="true">确定</button>
      </div>
    </form>
  </div>
</div>

</div>

<div class="redEnvolope" id="redEnvolope">
  <div class="env-box">
    <div class="env-container">
      <div class="pre-open" id="preOpen">
        <div class="top" style="background-image: url(&quot;https://img-home.csdnimg.cn/images/20230131025150.png&quot;);">
          <header>
            <img class="clearTpaErr" :src="redpacketAuthor.avatar" alt="">
            <div class="author">成就一亿技术人!</div>
          </header>
          <div class="bot-icon"></div>
        </div>
        <footer style="background-image: url(&quot;https://img-home.csdnimg.cn/images/20230131025228.png&quot;);">
          <div class="red-openbtn open-start" style="background-image: url(&quot;https://img-home.csdnimg.cn/images/20230131025209.png&quot;);"></div>
          <div class="tip">
            领取后你会自动成为博主和红包主的粉丝
            <a class="rule" target="_blank" href="https://blogdev.blog.csdn.net/article/details/128932621">规则</a>
          </div>
        </footer>
      </div>
      <div class="opened" id="opened">
        <div class="bot-icon">
          <header>
            <a class="creatorUrl" href="https://blog.csdn.net/weixin_53622554/article/details/129883195" target="_blank">
              <img class="clearTpaErr" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/1_hope_wisdom" alt="">
            </a>
            <div class="author">
              <div class="tt">hope_wisdom</div> 发出的红包
            </div>
          </header>
        </div>
        <div class="receive-box">
          <header></header>
          <div class="receive-list">
          </div>
        </div>
      </div>
    </div>
    <div class="close-btn"></div>
  </div>
</div>
<div id="rewardNew" class="reward-popupbox-new">
	<p class="rewad-title">打赏作者<span class="reward-close"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/closeBt.png"></span></p>
	<dl class="profile-box">
		<dd>
		<a href="https://blog.csdn.net/weixin_53622554" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_53622554&quot;,&quot;ab&quot;:&quot;new&quot;}">
			<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ef60164a8b2f481f98561d867bc0d251_weixin_53622554.jpg!1" class="avatar_pic">
		</a>
		</dd>
		<dt>
			<p class="blog-name">Surpass余sheng军</p>
			<p class="blog-discript">你的鼓励将是我创作的最大动力</p>
		</dt>
	</dl>
	<div class="reward-box-new">
			<div class="reward-content"><div class="reward-right"></div></div>
	</div>
	<div class="money-box">
				<span class="choose-money choosed" data-id="2">¥2</span>
				<span class="choose-money " data-id="4">¥4</span>
				<span class="choose-money " data-id="6">¥6</span>
				<span class="choose-money " data-id="10">¥10</span>
				<span class="choose-money " data-id="20">¥20</span>
				<input id="customizeMoney" class="customize-money" name="" type="" value="" placeholder="自定义">
				<div class="customize-tip">输入1-500的整数</div>
	</div>
	<div class="pay-box">
		<div class="pay-type-blance pay-type active" data-type="blance">
			<img class="unchoose" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newUnChoose.png" alt="">
			<img class="choose" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newChoose.png" alt="">
			<span class="pay-type-name">余额支付</span>
			<span class="pay-type-num">(余额：-- )</span>
		</div>
		<div class="pay-type-money pay-type" data-type="money">
			<img class="unchoose" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newUnChoose.png" alt="">
			<img class="choose" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newChoose.png" alt="">
			<span class="pay-type-name">扫码支付</span>
		</div>
	</div>
	<div class="sure-box">
		<div class="sure-box-money">
			<div class="code-box">
				<div class="code-num-box">
					<span class="code-name">扫码支付：</span><span class="code-num">¥2</span>
				</div>
				<div class="code-img-box">
					<div class="renovate">
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/pay-time-out.png">
					<span>获取中</span>
					</div>
				</div>
				<div class="code-pay-box">
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newWeiXin.png" alt="">
					<img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/newZhiFuBao.png" alt="">
					<span>扫码支付</span>
				</div>
			</div>
		</div>
		<div class="sure-box-blance">
			<p class="tip">您的余额不足，请更换扫码支付或<a target="_blank" data-report-click="{&quot;mod&quot;:&quot;1597646289_003&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4302&quot;}" href="https://i.csdn.net/#/wallet/balance/recharge?utm_source=RewardVip" class="go-invest">充值</a></p>
			<p class="is-have-money"><a class="reward-sure">打赏作者</a></p>
		</div>
	</div>
</div>
      <div class="pay-code">
      <div class="pay-money">实付<span class="pay-money-span" data-nowprice="" data-oldprice="">元</span></div>
      <div class="content-blance"><a class="blance-bt" href="javascript:;">使用余额支付</a></div>
      <div class="content-code">
        <div id="payCode" data-id="">
          <div class="renovate">
            <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/pay-time-out.png">
            <span>点击重新获取</span>
          </div>
        </div>
        <div class="pay-style"><span><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/weixin.png"></span><span><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/zhifubao.png"></span><span><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/jingdong.png"></span><span class="text">扫码支付</span></div>
      </div>
      <div class="bt-close">
        <svg t="1567152543821" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10924" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12">
          <defs>
            <style type="text/css"></style>
          </defs>
          <path d="M512 438.378667L806.506667 143.893333a52.032 52.032 0 1 1 73.6 73.621334L585.621333 512l294.485334 294.485333a52.074667 52.074667 0 0 1-73.6 73.642667L512 585.621333 217.514667 880.128a52.053333 52.053333 0 1 1-73.621334-73.642667L438.378667 512 143.893333 217.514667a52.053333 52.053333 0 1 1 73.621334-73.621334L512 438.378667z" fill="" p-id="10925"></path>
        </svg>
      </div>
      <div class="pay-balance">
        <input type="radio" class="pay-code-radio" data-type="details">
        <span class="span">钱包余额</span>
          <span class="balance" style="color:#FC5531;font-size:14px;">0</span>
          <div class="pay-code-tile">
            <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/pay-help.png" alt="">
            <div class="pay-code-content">
              <div class="span">
                <p class="title">抵扣说明：</p>
                <p> 1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。<br> 2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。</p>
              </div>
            </div>
          </div>
      </div>
      <a class="pay-balance-con" href="https://i.csdn.net/#/wallet/balance/recharge" target="_blank"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/recharge.png" alt=""><span>余额充值</span></a>
    </div>
    <div style="display:none;">
      <img src="https://blog.csdn.net/weixin_53622554/article/details/129883195" onerror="setTimeout(function(){if(!/(csdn.net|iteye.com|baiducontent.com|googleusercontent.com|360webcache.com|sogoucdn.com|bingj.com|baidu.com)$/.test(window.location.hostname)){window.location.href=&quot;\x68\x74\x74\x70\x73\x3a\x2f\x2f\x77\x77\x77\x2e\x63\x73\x64\x6e\x2e\x6e\x65\x74&quot;}},3000);">
    </div>
      <div class="keyword-dec-box" id="keywordDecBox"></div>
  
    
    <link rel="stylesheet" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/chart.css">
    <script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/chart.min.js.下载"></script>
    <script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/widget2chart.js.下载"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/axios-83fa28cedf.min.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/pc_wap_highlight-8defd55d6e.min.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/pc_wap_common-be82269d23.min.js.下载" type="text/javascript"></script>
  <ins class="adsbygoogle adsbygoogle-noablate" data-adsbygoogle-status="done" style="display: none !important;" data-ad-status="unfilled"><div id="aswift_0_host" style="border: none; height: 0px; width: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; background-color: transparent; display: inline-block;" tabindex="0" title="Advertisement" aria-label="Advertisement"><iframe id="aswift_0" name="aswift_0" style="left:0;position:absolute;top:0;border:0;width:undefinedpx;height:undefinedpx;" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ads(1).html" data-google-container-id="a!1" data-load-complete="true"></iframe></div></ins><script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/edit_copy_code-2d3931414f.min.js.下载" type="text/javascript"></script>
  <link rel="stylesheet" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/atom-one-light.css">
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-accusation.js.下载" type="text/javascript"></script>
  <script>
    // 全局声明
    if (window.csdn === undefined) {
      window.csdn = {};
    }
    window.csdn.sideToolbar = {
      options: {
        report: {
          isShow: true,
        },
        qr: {
          isShow: false,
        },
        guide: {
          isShow: true
        }
      }
    }
    $(function() {
      $(document).on('click', "a.option-box[data-type='report']", function() {
        window.csdn.loginBox.key({
          biz: 'blog',
          subBiz: 'other_service',
          cb: function() {
            window.csdn.feedback({
              "type": 'blog',
              "rtype": 'article',
              "rid": articleId,
              "reportedName": username,
              "submitOptions": {
                "title": articleTitle,
                "contentUrl": articleDetailUrl
              },
              "callback": function() {
                showToast({
                  text: "感谢您的举报，我们会尽快审核！",
                  bottom: '10%',
                  zindex: 9000,
                  speed: 500,
                  time: 1500
                })
              }
            })
          }
        })
      });
    })
  </script>
    <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/baidu-search.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/qrcode.js.下载"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/qrcode.min.js.下载"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-ordercart.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/user-ordertip.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/order-payment.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/common-346b634517.min.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/detail-434942c04f.min.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/column-3911b0dc26.min.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/side-toolbar.js.下载" type="text/javascript"></script>
  <script src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/copyright.js.下载" type="text/javascript"></script>
  <script>
    $(".MathJax").remove();
    if ($('div.markdown_views pre.prettyprint code.hljs').length > 0) {
      $('div.markdown_views')[0].className = 'markdown_views';
    }
  </script>
  <script type="text/javascript" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/MathJax.js.下载"></script>
  <script type="text/x-mathjax-config;executed=true">
    MathJax.Hub.Config({
      "HTML-CSS": {
        linebreaks: { automatic: true, width: "94%container" },
        imageFont: null
      },
      tex2jax: {
      preview: "none",
      ignoreClass:"title-article"
      },
      mml2jax: {
      preview: 'none'
      }
    });
  </script>
<script type="text/javascript" crossorigin="" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/csdn-login-box.js.下载"></script><div id="pointDivs"><div class="point-outer point-pre"><div class="point-inner"></div></div><div class="point-outer point-pre"><div class="point-inner"></div></div><div class="point-outer point-pre"><div class="point-inner"></div></div><div class="point-outer point-pre"><div class="point-inner"></div></div><div class="point-outer point-pre"><div class="point-inner"></div></div></div><div id="st_mask" onclick="closeMask()" style="width: 100%; height: 100%; background: rgba(0, 0, 0, 0.4); position: fixed; left: 0px; top: 0px; display: none; z-index: 1;"></div><div id="st_confirmBox" style="width: 360px; position: fixed; text-align: left; display: none; z-index: 100; inset: 0px; height: 208px; margin: auto;"><div id="st_confirm" style="background: rgb(255, 255, 255); border-radius: 4px; overflow: hidden; padding: 24px; width: 360px; height: 208px;"><span id="st_confirm_tit" style="width: 100%; max-height: 24px; font-size: 18px; font-weight: 500; color: rgb(34, 34, 38); line-height: 24px; text-align: left; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"></span><span id="st_confirm_text" style="text-align: left; height: 44px; font-size: 14px; font-weight: 400; color: rgb(85, 86, 102); line-height: 22px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; text-overflow: ellipsis; -webkit-line-clamp: 2; margin-top: 16px; margin-bottom: 40px;"></span><span class="st_confirm_btn success" style="background: rgb(252, 85, 51); color: rgb(255, 255, 255); text-align: center; display: block; width: 88px; height: 36px; line-height: 36px; margin-left: 16px; float: right; border-radius: 18px;">确定</span><span class="st_confirm_btn cancel" style="color: rgb(34, 34, 38); text-align: center; display: block; width: 88px; height: 36px; line-height: 36px; margin-left: 16px; float: right; box-sizing: border-box; border: 1px solid rgb(204, 204, 216); border-radius: 18px;">取消</span><span id="st_confirm_close" style="display: block; width: 12px; height: 12px; position: absolute; text-align: center; z-index: 100; top: 24px; right: 24px;"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/closeBt.png" style="display: block; width: 12px; height: 12px;"></span><div style="clear: both; display: block;"></div></div></div><div id="st_alertBox" style="width: 100%; position: fixed; left: 0px; top: 34%; text-align: center; display: none; z-index: 2;"><div id="st_alert" style="width: 80%; margin: 0px auto; background: rgb(255, 255, 255); border-radius: 2px; overflow: hidden; padding-top: 20px; text-align: center;"><span id="st_alert_text" style="background: rgb(255, 255, 255); overflow: hidden; padding: 15px 8px 30px; text-align: center; display: block;"></span><span id="st_alert_btn" onclick="closeMask()" style="background: rgb(27, 121, 248); color: rgb(255, 255, 255); padding: 8px; text-align: center; display: block; width: 72%; margin: 0px auto 20px; border-radius: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"></span></div></div><div id="st_toastBox" style="width: 100%; position: fixed; left: 0px; bottom: 10%; text-align: center; display: none;"><span id="st_toastContent" style="color: rgb(255, 255, 255); background: rgba(0, 0, 0, 0.8); padding: 8px 24px; border-radius: 4px; max-width: 80%; display: inline-block; font-size: 16px;"></span></div> <div class="report-box">  <div class="pos-boxer">      <div class="pos-content">          <div class="box-title">              <p>举报</p>              <img class="icon btn-close" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/closeBlack.png">          </div>          <div class="box-header">              <div class="box-top"><span>选择你想要举报的内容（必选）</span></div>              <div class="box-botoom">                  <ul>                      <li data="1" type="nei">内容涉黄</li>                      <li data="2" type="nei">政治相关</li>                      <li data="3" type="nei">内容抄袭</li>                      <li data="4" type="nei">涉嫌广告</li>                      <li data="5" type="nei">内容侵权</li>                      <li data="6" type="nei">侮辱谩骂</li>                      <li data="8" type="nei">样式问题</li>                      <li data="7" type="nei">其他</li>                  </ul>              </div>          </div>          <div>          <div class="box-content">          </div>          <div class="box-content">          </div>                    <div class="box-content" style="display:none;">                  <div class="box-content-top">                          <span>原文链接（必填）</span>                      </div>                      <div class="box-content-bottom" style="padding-bottom: 16px;">                        <div class="box-input" style="height: 32px;line-height: 32px;">                        <input class="content-input" type="text" id="originalurl" name="originalurl" placeholder="请输入被侵权原文链接">                        </div>                      </div>          </div>          <div class="box-content">          </div>          <div class="box-content" style="display:none;">                  <div class="box-content-top">                          <span>请选择具体原因（必选）</span>                      </div>                  <div class="box-content-bottom">                          <ul>                              <li sub_type="1">包含不实信息</li>                              <li sub_type="2">涉及个人隐私</li>                          </ul>                      </div>          </div>          <div class="box-content" style="display:none;">                  <div class="box-content-top">                          <span>请选择具体原因（必选）</span>                      </div>                  <div class="box-content-bottom">                          <ul>                              <li sub_type="1">侮辱谩骂</li>                              <li sub_type="2">诽谤</li>                          </ul>                  </div>          </div>          <div class="box-content" style="display:none;">                <div class="box-content-top">                        <span>请选择具体原因（必选）</span>                    </div>                <div class="box-content-bottom">                        <ul>                            <li sub_type="1">搬家样式</li>                            <li sub_type="2">博文样式</li>                        </ul>                </div>          </div>          <div class="box-content" style="display:none;">          </div>          </div>            <div id="cllcont" style="display:none;">            <div class="box-content-top">              <span class="box-content-span">补充说明（选填）</span>            </div>                <div class="box-content-bottom">                  <div class="box-input">                    <textarea class="ipt ipt-textarea" style="padding:0;" name="description" placeholder="请详细描述您的举报内容"></textarea>                  </div>                </div>            </div>            </div>      <div class="pos-footer">          <p class="btn-close">取消</p>          <p class="box-active">确定</p>      </div>  </div></div><svg aria-hidden="true" style="position: absolute; width: 0px; height: 0px; overflow: hidden;"><symbol id="sousuo" viewBox="0 0 1024 1024"><path d="M719.6779726 653.55865555l0.71080936 0.70145709 191.77828505 191.77828506c18.25658185 18.25658185 18.25658185 47.86273439 0 66.12399318-18.26593493 18.26125798-47.87208744 18.26125798-66.13334544 0l-191.77828505-191.77828506c-0.2338193-0.2338193-0.4676378-0.4676378-0.69678097-0.71081014-58.13206223 44.25257003-130.69075187 70.51978897-209.38952657 70.51978894C253.06424184 790.19776156 98.14049639 635.27869225 98.14049639 444.17380511S253.06424184 98.14049639 444.16912898 98.14049639c191.10488633 0 346.02863258 154.92374545 346.02863259 346.02863259 0 78.6987747-26.27189505 151.25746514-70.51978897 209.38952657z m-275.50884362 43.11621045c139.45428506 0 252.50573702-113.05145197 252.50573702-252.50573702s-113.05145197-252.50573702-252.50573702-252.50573783-252.50573702 113.05145197-252.50573783 252.50573783 113.05145197 252.50573702 252.50573783 252.50573702z"></path></symbol><symbol id="gonggong_csdnlogo_" viewBox="0 0 4096 1024"><path d="M1234.16069807 690.46341551c62.96962316 23.02318413 194.30703694 45.91141406 300.51598128 45.91141406 114.44114969 0 178.13952547-31.68724287 183.2407937-80.86454822 4.642424-44.8587714-42.21366937-50.93170978-171.44579784-81.53931916-178.57137886-43.77913792-292.49970264-111.55313011-281.32549604-219.86735976 12.9825927-125.75031047 181.27046257-220.78504823 439.49180199-220.78504822 125.88526465 0 247.93783044 8.87998544 311.17736197 29.60894839l-21.7006331 158.57116851c-41.05306337-14.27815288-198.1937175-34.11641822-304.48363435-34.11641822-107.7744129 0-163.56447339 33.90049151-167.42416309 71.06687432-4.85835069 47.04502922 51.14763648 49.23128703 191.14910897 86.50563321 189.58364043 48.09767188 272.47250144 115.81768239 261.6221849 220.81203906-12.71268432 123.51007099-164.13128096 228.53141851-466.48263918 228.53141851-125.85827383 0-234.33444849-22.96920244-294.09216204-45.93840492l19.730302-157.86940672zM3010.8325562 172.75216735c688.40130256-129.79893606 747.80813523 103.42888812 726.53935551 309.80082928l-40.08139323 381.78539207h-218.51781789l36.57258439-348.20879061c7.90831529-76.68096846 57.13960232-226.66905073-180.54170997-221.05495659-82.26807176 1.99732195-123.05122675 13.2794919-123.05122677 13.27949188s-7.15257186 92.65954408-15.81663059 161.13529804l-41.43093509 394.84895728h-214.3072473l42.53755943-389.15389062 28.09746151-302.43233073z m-869.48282929-18.05687008c49.12332368-5.34418577 124.58970448-10.76934404 228.45044598-10.76934405 173.38913812 0 313.57954648 30.17575597 400.38207891 93.63121421 77.94953781 59.16391512 129.82592689 154.95439631 115.4668015 293.74128117-13.25250106 129.15115596-80.405704 219.57046055-178.16651631 275.4954752-89.44763445 52.74009587-202.16137055 75.27744492-371.66382812 75.27744493-99.94707012 0-195.27870708-5.39816743-267.77609576-16.14052064L2141.37671774 154.69529727z m143.26736381 569.85754561c16.70732823 3.23890047 38.67786969 6.45081009 81.99816339 6.45081009 173.44311979 0 295.7386031-85.23706385 308.01943403-205.07638097 17.84094339-173.2271931-90.63523129-233.79463176-273.39018992-232.74198912-23.67096422 0-56.57279475 0-73.98188473 3.1849188l-42.6725136 428.15565036z" fill="#262626"></path><path d="M1109.8678928 870.30336371c-41.10704503 14.25116203-126.26313639 23.96786342-245.23874671 23.96786342-342.13585224 0-526.8071603-160.59548129-504.97157302-372.90540663C385.78470347 268.40769434 659.36382925 126.08500985 958.9081404 126.08500985c116.00661824 0 184.32042718 9.33882968 248.31570215 24.99351522l-20.5400271 170.42014604c-42.56455024-14.33213455-142.32268451-27.50366309-223.07926938-27.50366311-176.25016686 0-325.94134993 52.49717834-343.10752238 218.57179958-15.30380469 148.50358623 89.7715245 219.48948804 288.04621451 219.48948804 69.0155707 0 170.77102691-9.8786464 217.81605614-24.15679928l-16.49140154 162.40386737z" fill="#CA0C16"></path></symbol><symbol id="gonggong_csdnlogodanse_" viewBox="0 0 4096 1024"><path d="M1229.41995733 690.46341551c62.96962316 23.02318413 194.30703694 45.91141406 300.51598128 45.91141406 114.44114969 0 178.13952547-31.68724287 183.2407937-80.86454822 4.642424-44.8587714-42.21366937-50.93170978-171.44579784-81.53931916-178.57137886-43.77913792-292.49970264-111.55313011-281.32549604-219.86735976 12.9825927-125.75031047 181.27046257-220.78504823 439.49180199-220.78504822 125.88526465 0 247.93783044 8.87998544 311.17736197 29.60894839l-21.7006331 158.57116851c-41.05306337-14.27815288-198.1937175-34.11641822-304.48363435-34.11641822-107.7744129 0-163.56447339 33.90049151-167.42416309 71.06687432-4.85835069 47.04502922 51.14763648 49.23128703 191.14910897 86.50563321 189.58364043 48.09767188 272.47250144 115.81768239 261.6221849 220.81203906-12.71268432 123.51007099-164.13128096 228.53141851-466.48263918 228.53141851-125.85827383 0-234.33444849-22.96920244-294.09216204-45.93840492l19.730302-157.86940672zM3006.09181546 172.75216735c688.40130256-129.79893606 747.80813523 103.42888812 726.53935551 309.80082928l-40.08139323 381.78539207h-218.51781789l36.57258439-348.20879061c7.90831529-76.68096846 57.13960232-226.66905073-180.54170997-221.05495659-82.26807176 1.99732195-123.05122675 13.2794919-123.05122677 13.27949188s-7.15257186 92.65954408-15.81663059 161.13529804l-41.43093509 394.84895728h-214.3072473l42.53755943-389.15389062 28.09746151-302.43233073z m-869.48282929-18.05687008c49.12332368-5.34418577 124.58970448-10.76934404 228.45044598-10.76934405 173.38913812 0 313.57954648 30.17575597 400.38207891 93.63121421 77.94953781 59.16391512 129.82592689 154.95439631 115.4668015 293.74128117-13.25250106 129.15115596-80.405704 219.57046055-178.16651631 275.4954752-89.44763445 52.74009587-202.16137055 75.27744492-371.66382812 75.27744493-99.94707012 0-195.27870708-5.39816743-267.77609576-16.14052064L2136.635977 154.69529727z m143.26736381 569.85754561c16.70732823 3.23890047 38.67786969 6.45081009 81.99816339 6.45081009 173.44311979 0 295.7386031-85.23706385 308.01943403-205.07638097 17.84094339-173.2271931-90.63523129-233.79463176-273.39018992-232.74198912-23.67096422 0-56.57279475 0-73.98188473 3.1849188l-42.6725136 428.15565036z m-1174.74919792 145.75052083c-41.10704503 14.25116203-126.26313639 23.96786342-245.23874671 23.96786342-342.13585224 0-526.8071603-160.59548129-504.97157303-372.90540663C381.04396273 268.40769434 654.62308851 126.08500985 954.16739966 126.08500985c116.00661824 0 184.32042718 9.33882968 248.31570215 24.99351522l-20.5400271 170.42014604c-42.56455024-14.33213455-142.32268451-27.50366309-223.07926938-27.50366311-176.25016686 0-325.94134993 52.49717834-343.10752238 218.57179958-15.30380469 148.50358623 89.7715245 219.48948804 288.04621451 219.48948804 69.0155707 0 170.77102691-9.8786464 217.81605614-24.15679928l-16.49140154 162.40386737z"></path></symbol><symbol id="xieboke1" viewBox="0 0 1024 1024"><path d="M204.70021457 751.89799169h657.99199211a33.6932867 33.6932867 0 0 1 0 67.33536736H163.68452703a33.53966977 33.53966977 0 0 1-18.74125054-5.68382181c-18.63883902-9.4218307-18.17798882-29.44322156-15.20806401-39.17228615C199.0675982 570.27171976 309.41567149 409.58853908 435.38145354 290.12586836A243.22661203 243.22661203 0 0 1 536.97336934 234.20935065c138.10150976-33.79569759 228.3257813-29.95527721 318.60125827-28.52152054-17.15387692 20.48224105-36.20236071 41.6301547-57.29906892 62.93168529-3.1747472 3.22595323-164.67721739 19.91897936-187.97576692 47.05794871-23.29854894 27.13896932 129.60138005 7.37360691 125.19769798 11.11161576-21.6599699 18.33160576-44.90731339 36.4071831-69.94685287 53.8682939-4.50609297 3.1747472-149.52035944-0.35843931-174.61110436 27.85584737-25.19315641 28.16308124 101.89914903 18.12678338 96.0617103 21.40394206-67.43777825 37.63611797-125.96578207 64.62147036-212.70807253 93.8086635-57.65750823 19.4069231-121.8181284 133.13456658-146.5504346 179.06599187a435.75967738 435.75967738 0 0 0-23.04252112 49.10617311z" fill="#CA0C16"></path></symbol><symbol id="gitchat" viewBox="0 0 1024 1024"><path d="M892.08971773 729.08552746h-108.597062v-162.89559374H403.40293801v-108.59706198h488.68677972v271.49265572z m-651.58237345 54.298531V783.49265572h488.68678045v108.59706201H131.91028227V131.91028227h760.17943546v217.19412473h-108.597062V240.50734428H240.50734428v542.87671418z m542.98531145 0h108.597062v108.59706199h-108.597062v-108.59706199z" fill="#FF9100"></path></symbol><symbol id="toolbar-memberhead" viewBox="0 0 1303 1024"><path d="M1061.51168438 433.79527648A78.51879902 78.51879902 0 1 1 1129.35192643 472.74060007h-1.80593246l-48.05350474 403.97922198c-4.55409058 38.16013652-39.41643684 67.133573-80.79584389 67.13357302H319.35199503c-41.30088817 0-76.00619753-28.81639958-80.717325-66.97653526L189.01078861 472.74060007H187.12633728a78.51879902 78.51879902 0 1 1 67.76172401-38.86680556l193.31328323 119.81968805 158.13686148-336.06046024A78.5973179 78.5973179 0 0 1 658.23913228 80.14660493a78.51879902 78.51879902 0 0 1 51.58685077 137.721974l158.13686147 335.82490362 193.54883986-119.89820607z" fill="#FDD840"></path><path d="M1050.8331274 394.22180104a78.51879902 78.51879902 0 1 1 78.51879903 78.51879903h-1.80593246l-48.05350474 403.97922198c-4.55409058 38.16013652-39.41643684 67.133573-80.79584389 67.13357302H659.02432018C658.47468805 793.25433807 658.23913228 505.32590231 658.23913228 80.14660493a78.51879902 78.51879902 0 0 1 51.58685077 137.721974l158.13686147 335.82490362 193.54883986-119.89820607A78.51879902 78.51879902 0 0 1 1050.8331274 394.22180104z" fill="#FFBE00"></path></symbol><symbol id="toolbar-m-memberhead" viewBox="0 0 1303 1024"><path d="M1062.74839935 433.79527648A78.51879902 78.51879902 0 1 1 1130.58864141 472.74060007h-1.80593246l-48.05350474 403.97922198c-4.55409058 38.16013652-39.41643685 67.133573-80.79584389 67.13357302H320.58871c-41.30088817 0-76.00619753-28.81639958-80.71732499-66.97653526L190.24750358 472.74060007H188.36305226a78.51879902 78.51879902 0 1 1 67.761724-38.86680556l193.31328324 119.81968805 158.13686147-336.06046024A78.5973179 78.5973179 0 0 1 659.47584726 80.14660493a78.51879902 78.51879902 0 0 1 51.58685076 137.721974l158.13686148 335.82490362 193.54883985-119.89820607z" fill="#D6D6D6"></path><path d="M1052.06984238 394.22180104a78.51879902 78.51879902 0 1 1 78.51879903 78.51879903h-1.80593246l-48.05350474 403.97922198c-4.55409058 38.16013652-39.41643685 67.133573-80.79584389 67.13357302H660.26103515C659.71140302 793.25433807 659.47584726 505.32590231 659.47584726 80.14660493a78.51879902 78.51879902 0 0 1 51.58685076 137.721974l158.13686148 335.82490362 193.54883985-119.89820607A78.51879902 78.51879902 0 0 1 1052.06984238 394.22180104z" fill="#C1C1C1"></path></symbol><symbol id="csdnc-upload" viewBox="0 0 1024 1024"><path d="M216.37466416 723.16095396v84.46438188h591.25067168v-84.46438188c0-23.32483876 18.90735218-42.23219094 42.23219093-42.23219021s42.23219094 18.90735218 42.23219096 42.23219021v84.46438188c0 46.64967827-37.81470362 84.46438188-84.46438189 84.46438189H216.37466416c-46.64967827 0-84.46438188-37.81470362-84.46438189-84.4643819v-84.46438187c0-23.32483876 18.90735218-42.23219094 42.23219096-42.23219021s42.23219094 18.90735218 42.23219094 42.23219021zM469.76780906 275.55040991L246.55378774 499.53305726a42.30820888 42.30820888 0 0 1-59.99082735 0c-16.56346508-16.62259056-16.56346508-43.57095155 0-60.19354139L480.51167818 144.38144832A42.21952103 42.21952103 0 0 1 512 131.93984464a42.20262858 42.20262858 0 0 1 31.48409853 12.44160369l293.95294108 294.95806754c16.56346508 16.62259056 16.56346508 43.57095155 0 60.19354139a42.30820888 42.30820888 0 0 1-59.99082735 0L554.23219094 275.55040991V680.92876375c0 23.32483876-18.90735218 42.23219094-42.23219094 42.23219021s-42.23219094-18.90735218-42.23219094-42.23219021V275.55040991z"></path></symbol></svg><div>
  <div class="csdn-side-toolbar " style="left: 1670.33px;"><a class="option-box directory directory-show" data-type="show" style="display:flex" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.7790&quot;}">        <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconShowDirectory.png" alt="" srcset=""><img style="display:block" class="icon-option-beta" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconSideBeta.png" alt="" srcset="">        <span class="show-txt">只看<br>目录</span>      </a><a class="option-box directory directory-hide" data-type="hide" style="display: none;" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.7791&quot;}">        <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconHideDirectory.png" alt="" srcset=""><img style="display:block" class="icon-option-beta" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconSideBeta.png" alt="" srcset="">        <span class="show-txt">隐藏<br>目录</span>      </a><a class="option-box sidecolumn sidecolumn-show" data-type="show" style="display: none;" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.7788&quot;}">        <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconShowSide.png" alt="" srcset=""><img style="display:block" class="icon-option-beta" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconSideBeta.png" alt="" srcset="">        <span class="show-txt">显示<br>侧栏</span>      </a><a class="option-box sidecolumn sidecolumn-hide" data-type="hide" style="display:flex" data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.7789&quot;}">        <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconHideSide.png" alt="" srcset=""><img style="display:block" class="icon-option-beta" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/iconSideBeta.png" alt="" srcset="">        <span class="show-txt">隐藏<br>侧栏</span>      </a>
    
    <a class="option-box" data-type="guide">
      <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/guide.png" alt="" srcset="">
      <span class="show-txt">新手<br>引导</span>
    </a>
    
    
    
    
    
    <a class="option-box" data-type="cs">
      <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/kefu.png" alt="" srcset="">
      <span class="show-txt">客服</span>
    </a>
    
    
    
    <a class="option-box" data-type="report">
      <span class="show-txt" style="display:flex;opacity:100;">举报</span>
    </a>
    
    
    <a class="option-box" data-type="gotop">
      <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/fanhuidingbucopy.png" alt="" srcset="">
      <span class="show-txt">返回<br>顶部</span>
    </a>
    
  </div>
  </div><iframe name="googlefcPresent" style="display: none; width: 0px; height: 0px; border: none; z-index: -1000; left: -1000px; top: -1000px;" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/saved_resource(3).html"></iframe><div class="imgViewDom">        <div class="swiper swiper-container-initialized swiper-container-horizontal">          <a class="close-btn">            <img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/quoteClose1White.png">          </a>          <div class="swiper-wrapper" style="transition: all 0ms ease 0s;"><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/628299e6ff2145049b00d8ffa70f69ec.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/628299e6ff2145049b00d8ffa70f69ec.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/42c3722ac0b947ffa243f0252923ef37.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/42c3722ac0b947ffa243f0252923ef37.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/75f6dcb667d34f3a91a07551932dfe4b.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/75f6dcb667d34f3a91a07551932dfe4b.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ec2c5e5987db43afb135388779a1294b.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/ec2c5e5987db43afb135388779a1294b.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/84d5c1fba16040e1a45667870a7f9547.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/84d5c1fba16040e1a45667870a7f9547.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/d23749c68ec843529f72a2491a6ac280.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/d23749c68ec843529f72a2491a6ac280.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/bf37ef76b2544ac5bbfb4e6577a24e66.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/bf37ef76b2544ac5bbfb4e6577a24e66.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/b690128b5c01410d8d4a4f3a736e136b.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/b690128b5c01410d8d4a4f3a736e136b.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/6ef1344dfc3541ed8cfb3b14c0312c01.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/6ef1344dfc3541ed8cfb3b14c0312c01.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a16f8abf35c64b65a1c367c3a43194f0.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a16f8abf35c64b65a1c367c3a43194f0.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a6cc057d08d44e7aa20a7c0430ea2b2e.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a6cc057d08d44e7aa20a7c0430ea2b2e.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e784eaed0dd74a29898bf40a6a88f69f.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e784eaed0dd74a29898bf40a6a88f69f.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/152f003155d6441f9a674de9de10812e.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/152f003155d6441f9a674de9de10812e.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/5ae5a3d8268e4907845e17418e206a75.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/5ae5a3d8268e4907845e17418e206a75.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/097848c9b40441efab814d4297aa843c.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/097848c9b40441efab814d4297aa843c.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/85a109814ed54e039f055dcd527b8887.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/85a109814ed54e039f055dcd527b8887.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/48e9598868594525bff8019e4ebbd5c5.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/48e9598868594525bff8019e4ebbd5c5.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/1863ad612ab2444c858f1a155ad4266e.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/1863ad612ab2444c858f1a155ad4266e.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/9855cb3328eb4cfcad46af94b9fa3675.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/9855cb3328eb4cfcad46af94b9fa3675.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/9edfe4ec1b2340db8fa96d030c9c0cf3.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/9edfe4ec1b2340db8fa96d030c9c0cf3.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/edd1471e450a42f683d6e724d1e6a7f8.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/edd1471e450a42f683d6e724d1e6a7f8.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/cd9487e7e1564949b93ca3b3ff55d2c5.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/cd9487e7e1564949b93ca3b3ff55d2c5.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/4d34e0c66ead435a99622728a24f0db9.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/4d34e0c66ead435a99622728a24f0db9.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e3250cb36e8f4f7fa2090d0eff43c8e6.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e3250cb36e8f4f7fa2090d0eff43c8e6.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/15ef182baa4a4cb3b4862a85a8e5c27a.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/15ef182baa4a4cb3b4862a85a8e5c27a.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/8ce47295b5b5455d9dcff85e4843eee1.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/8ce47295b5b5455d9dcff85e4843eee1.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a44cce15321e433988fb85a7921eb72d.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a44cce15321e433988fb85a7921eb72d.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a4c3e2f7af57465397a4edbaf341fb08.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a4c3e2f7af57465397a4edbaf341fb08.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/99b6179ba9e54e23b2d042596a4a9f9f.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/99b6179ba9e54e23b2d042596a4a9f9f.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/095ed6bdeb884f99b548d53a88ea8a18.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/095ed6bdeb884f99b548d53a88ea8a18.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/448e65b4f8a44ab9b96dd5affacd3d97.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/448e65b4f8a44ab9b96dd5affacd3d97.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/d37288f92f664c4f99b38d0ea54d8532.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/d37288f92f664c4f99b38d0ea54d8532.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/facbcd28d14d4af59d1e48f5442a8a2f.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/facbcd28d14d4af59d1e48f5442a8a2f.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/75b6d3041ee34067bbf63fbd47e59824.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/75b6d3041ee34067bbf63fbd47e59824.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/66427bd5e011479d9540f3fbe6ba27c5.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/66427bd5e011479d9540f3fbe6ba27c5.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a2ff806cc9a241bfb5e0a7e3127ba808.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/a2ff806cc9a241bfb5e0a7e3127ba808.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/72489673ed4f4ec69c8bf3fbbc8a28fd.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/72489673ed4f4ec69c8bf3fbbc8a28fd.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/fd7f5de80ea546a8899129f54ed9d3bc.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/fd7f5de80ea546a8899129f54ed9d3bc.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/73a018553c914c56b4d696ab7e412828.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/73a018553c914c56b4d696ab7e412828.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/6f27049a639d41f6878ff0e1a80ad71f.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/6f27049a639d41f6878ff0e1a80ad71f.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e59c743af226474388fff7df93cec3d5.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/e59c743af226474388fff7df93cec3d5.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/09e3ebccf8894a6997f8f12b34131628.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/09e3ebccf8894a6997f8f12b34131628.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/46e7f923d70944f0bfe507492d0517a8.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/46e7f923d70944f0bfe507492d0517a8.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/cf01a18b95714b69ba7862714a6b2d7c.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/cf01a18b95714b69ba7862714a6b2d7c.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/4bc4eea055624831804f5cdb9c52c9c5.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/4bc4eea055624831804f5cdb9c52c9c5.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/df5ce002a2e040288ff96685b4dddf25.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/df5ce002a2e040288ff96685b4dddf25.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/2f276bfabb3f4564bbea20949fd38c98.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/2f276bfabb3f4564bbea20949fd38c98.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/7492205e5911488099b9505c6703f46f.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/7492205e5911488099b9505c6703f46f.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/7437721869d440f5a43c8781c3621dbb.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/7437721869d440f5a43c8781c3621dbb.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/b4d99a0b4e2045b5b845782de72d1cf3.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/b4d99a0b4e2045b5b845782de72d1cf3.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/3b8bc86d3bb7408c88084a29d1337fe5.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/3b8bc86d3bb7408c88084a29d1337fe5.png"></a></div><div class="swiper-slide"><a target="_blank" href="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/19e2aa66e18b440c8cd36858ffd348f9.png"><img src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/19e2aa66e18b440c8cd36858ffd348f9.png"></a></div></div>          <div class="swiper-button-prev" tabindex="0" role="button" aria-label="Previous slide" aria-disabled="false"></div>          <div class="swiper-button-next" tabindex="0" role="button" aria-label="Next slide" aria-disabled="false"></div>        <span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span></div>      </div><iframe src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/aframe.html" width="0" height="0" style="display: none;"></iframe><div class="notification" style="position: fixed; left:initial; right: 24px; top: 50px; bottom: initial; z-index: 99999;"></div>     <div id="articleSearchTip" class="article-search-tip" style="top: 21073px; left: 596px;">          <a class="article-href article-search" href="https://so.csdn.net/so/search?from=pc_blog_select&amp;q=SendMessageDemo" target="_blank"><img src="https://csdnimg.cn/release/blogv2/dist/pc/img/newarticleSearchWhite.png"><span class="article-text">搜索</span></a>          <a data-report-click="{&quot;spm&quot;:&quot;1001.2101.3001.6773&quot;}" class="article-href article-comment" href="javascript:;" data-type="comment"><img src="https://csdnimg.cn/release/blogv2/dist/pc/img/newarticleComment1White.png"><span class="article-text">评论</span></a>          <a class="article-href cnote" href="javascript:;" data-type="cnote"><img src="https://csdnimg.cn/release/blogv2/dist/pc/img/newcNoteWhite.png"><span class="article-text">笔记</span></a>          </div> </body><!-- 富文本柱状图  --><iframe id="google_esf" name="google_esf" src="./(527条消息) Java网络编程_Surpass余sheng军的博客-CSDN博客_files/zrt_lookup.html" style="display: none;"></iframe><div style="all: initial;"><div id="__hcfy__" style="all: initial;"><template shadowrootmode="open"><style>#root{-webkit-text-size-adjust:100%;box-sizing:border-box;font-size:14px;font-weight:400;letter-spacing:0;line-height:1.28581;text-transform:none;color:#182026;font-family:-apple-system,"BlinkMacSystemFont","Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Open Sans","Helvetica Neue","Icons16",sans-serif}#root{touch-action:manipulation}#root>.bp4-portal{z-index:9999999999}</style><link rel="stylesheet" href="chrome-extension://cjlbgpmmejcpkmjoflojmlhhkllmdapj/normalize.css"><link rel="stylesheet" href="chrome-extension://cjlbgpmmejcpkmjoflojmlhhkllmdapj/blueprint.css"><link rel="stylesheet" href="chrome-extension://cjlbgpmmejcpkmjoflojmlhhkllmdapj/blueprint-select.css"><link rel="stylesheet" href="chrome-extension://cjlbgpmmejcpkmjoflojmlhhkllmdapj/cropper.css"><style>#translate-panel{background-color:#f6f7f9;display:flex;flex-direction:column;padding-bottom:8px}.bp4-dark #translate-panel{background-color:#252a31}#translate-panel .fixed{flex-shrink:0;margin-bottom:10px}#translate-panel .body{flex-grow:1;overflow:auto;overscroll-behavior:contain}#translate-panel .body::-webkit-scrollbar{width:8px;background-color:rgba(0,0,0,0);-webkit-border-radius:100px}#translate-panel .body::-webkit-scrollbar:hover{background-color:rgba(0,0,0,.09)}#translate-panel .body::-webkit-scrollbar-thumb:vertical{background:rgba(0,0,0,.5);-webkit-border-radius:100px}#translate-panel .body::-webkit-scrollbar-thumb:vertical:active{background:rgba(0,0,0,.61);-webkit-border-radius:100px}#translate-panel.size-small,#translate-panel.size-small h6.bp4-heading,#translate-panel.size-small .bp4-control.bp4-large,#translate-panel.size-small textarea.bp4-input.bp4-small{font-size:14px}#translate-panel.size-small .phonetic-item,#translate-panel.size-small .quick-settings a{font-size:12px}#translate-panel.size-middle,#translate-panel.size-middle h6.bp4-heading,#translate-panel.size-middle .bp4-control.bp4-large,#translate-panel.size-middle textarea.bp4-input{font-size:18px}#translate-panel.size-middle .phonetic-item,#translate-panel.size-middle .quick-settings a{font-size:14px}#translate-panel.size-large,#translate-panel.size-large h6.bp4-heading,#translate-panel.size-large .bp4-control.bp4-large,#translate-panel.size-large textarea.bp4-input.bp4-large{font-size:22px}#translate-panel.size-large .source,#translate-panel.size-large .phonetic-item,#translate-panel.size-large .quick-settings a{font-size:18px}#translate-panel .bp4-button.bp4-small,#translate-panel .bp4-small .bp4-button{min-height:20px;min-width:20px}#translate-panel .header{display:flex;align-items:center;padding:4px 6px 4px 10px;border-bottom:1px solid #d1d1d1}.bp4-dark #translate-panel .header{border-bottom-color:rgba(17,20,24,.4)}#translate-panel .header .drag-block{min-width:5px;flex-shrink:0;flex-grow:1;align-self:stretch}#translate-panel .header .left{flex-shrink:0;display:flex}#translate-panel .header .right{flex-shrink:0;display:flex;align-items:center}#translate-panel .header .right .bp4-icon-arrow-right{flex-shrink:0;margin:0 5px}#translate-panel .header .right>.bp4-button{flex-shrink:0;margin:0 1px}#translate-panel .header .right>.bp4-button:last-child{margin-right:0}#translate-panel .quick-settings{padding:4px 9px;margin:0 1px}#translate-panel .quick-settings>div{margin-bottom:5px}#translate-panel .quick-settings .bp4-control{margin-bottom:0}#translate-panel .query-text{position:relative;padding:10px 10px 2px 10px}#translate-panel .query-text textarea.bp4-input{min-height:44px;font-family:system-ui,-apple-system,"Segoe UI","Roboto","Ubuntu","Cantarell","Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";overscroll-behavior:contain}#translate-panel .query-text .translate-btn{position:absolute;opacity:.6}#translate-panel .query-text .translate-btn:hover{opacity:1}#translate-panel .body{padding:0 10px}#translate-panel .body .bp4-card:first-child{margin-top:1px}#translate-panel .body .bp4-card:last-child{margin-bottom:1px}#translate-panel .body .no-api{margin:20px 0}.result-block{margin:8px 0;padding:2px 5px}.result-block .bp4-button{visibility:hidden}.result-block .error .bp4-button,.result-block:hover .bp4-button{visibility:visible}.result-block .legend{display:flex;align-items:center;justify-content:space-between}.result-block .legend .legend-left{display:flex;align-items:center}.result-block .legend .api-ico,.result-block .legend .bp4-heading{flex-shrink:0;white-space:nowrap}.result-block .legend .api-ico{display:inline-block;width:14px;height:14px;background-size:contain;margin-right:3px}.result-block .legend .bp4-heading{margin-bottom:0;margin-right:10px}.result-block .legend .source{cursor:pointer;font-size:12px;display:inline-flex;align-items:center}.result-block .legend .source .source-text{overflow:hidden}.result-block .legend .source .bp4-icon{position:relative;top:-1px;margin-left:1px}.result-block .phonetic{display:flex;flex-wrap:wrap}.result-block .phonetic .phonetic-item{display:flex;align-items:center;font-size:12px}.result-block .phonetic .phonetic-item:not(:last-child){margin-right:12px}.result-block .common-result p{line-height:1.3;margin:2px 0;overflow-wrap:break-word}.result-block .common-result .dict a{text-decoration:underline}.result-block .error{font-size:12px;padding:5px 10px}.result-block .dict-pos{margin-right:5px}.external-translators{margin-bottom:3px;padding:0;display:flex;flex-wrap:wrap}.external-translators>div{margin:0 5px 5px 0}.quick-links a{margin:0 5px 5px 0}#popper-container{width:250px;max-width:100%;position:absolute;left:0;top:0;z-index:9999999998;touch-action:none;transition:opacity .2s;background-color:#f6f7f9}.bp4-dark #popper-container{background-color:#252a31}#popper-container.show{opacity:1;pointer-events:auto;user-select:auto}#popper-container,#popper-container[data-popper-reference-hidden=true]{opacity:0;pointer-events:none;user-select:none}#popper-container .drag-block{cursor:grab}#popper-container.pin{position:fixed}#popper-container.pin .arrow{display:none}#popper-container .arrow,#popper-container .arrow::before{position:absolute;width:8px;height:8px;z-index:-1}#popper-container .arrow::before{content:"";transform:rotate(45deg);background:#f6f7f9}.bp4-dark #popper-container .arrow::before{background-color:#252a31}#popper-container .arrow{display:none}#popper-container.show[data-popper-placement]:not([data-popper-reference-hidden=true]) .arrow{display:block}#popper-container[data-popper-placement^=top] .arrow{bottom:-5px}#popper-container[data-popper-placement^=top] .arrow::before{border-right:1px solid #d1d1d1;border-bottom:1px solid #d1d1d1}#popper-container[data-popper-placement^=bottom] .arrow{top:-5px}#popper-container[data-popper-placement^=bottom] .arrow::before{border-left:1px solid #d1d1d1;border-top:1px solid #d1d1d1}#popper-container[data-popper-placement^=left] .arrow{right:-5px}#popper-container[data-popper-placement^=left] .arrow::before{border-right:1px solid #d1d1d1;border-top:1px solid #d1d1d1}#popper-container[data-popper-placement^=right] .arrow{left:-5px}#popper-container[data-popper-placement^=right] .arrow::before{border-left:1px solid #d1d1d1;border-bottom:1px solid #d1d1d1}#translate-btn{display:none;position:absolute;z-index:9999999999;left:0;top:0}#translate-btn .bp4-button{padding:2px;min-width:0;min-height:0}#translate-btn .btn-icon{width:18px;height:18px;background-image:url(chrome-extension://cjlbgpmmejcpkmjoflojmlhhkllmdapj/logo.png);background-size:contain}.bp4-dark #translate-btn .btn-icon{background-image:url(chrome-extension://cjlbgpmmejcpkmjoflojmlhhkllmdapj/logowhite36.png)}#translate-btn.show{display:block}.translate-type-selector .bp4-label{display:inline}.translate-type-selector .bp4-radio{margin-bottom:0}#ocr-container{position:fixed;z-index:99999999999999;left:0;top:0;right:0;bottom:0}#ocr-container .toolbar{display:none;position:absolute;z-index:1}#ocr-container img{max-width:100%}#app{cursor:default}.switch-pin{flex-shrink:0;cursor:pointer}.switch-pin .bp4-icon-pin{transition:transform .2s,color .2s;transform:rotate(-45deg)}.pin .switch-pin .bp4-icon-pin{transform:rotate(-70deg)}.cut-btn{margin-left:2px}.app-toaster-container{position:fixed !important;z-index:9999999999 !important}.app-toaster-container .bp4-toast{min-width:auto}#web-trs-panel .app-toaster-container{padding-right:0}</style><div id="root" dir="ltr"><div id="app"><div id="translate-btn" style=""><button type="button" class="bp4-button"><span class="btn-icon"></span></button></div><div id="popper-container" class="bp4-elevation-4" style="width: 250px; transform: translate(0px, 0px);"><div id="translate-panel" class="size-small"><div class="fixed"><div class="header"><div class="left"><div class="switch-pin"><button type="button" class="bp4-button bp4-minimal bp4-small"><span icon="pin" aria-hidden="true" class="bp4-icon bp4-icon-pin"><svg data-icon="pin" width="14" height="14" viewBox="0 0 16 16" role="img"><path d="M9.41.92c-.51.51-.41 1.5.15 2.56L4.34 7.54C2.8 6.48 1.45 6.05.92 6.58l3.54 3.54-3.54 4.95 4.95-3.54 3.54 3.54c.53-.53.1-1.88-.96-3.42l4.06-5.22c1.06.56 2.04.66 2.55.15L9.41.92z" fill-rule="evenodd"></path></svg></span></button></div><button type="button" title="图片翻译" class="bp4-button bp4-minimal bp4-small"><span icon="media" aria-hidden="true" class="bp4-icon bp4-icon-media"><svg data-icon="media" width="14" height="14" viewBox="0 0 16 16" role="img"><path d="M11.99 6.99c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm3-5h-14c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h14c.55 0 1-.45 1-1v-10c0-.55-.45-1-1-1zm-1 9l-5-3-1 2-3-4-3 5v-7h12v7z" fill-rule="evenodd"></path></svg></span></button><button type="button" title="语音翻译" class="bp4-button bp4-minimal bp4-small"><span class="bp4-icon"><svg version="1.1" id="Capa_1" width="14" height="14" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 490.9 490.9" xml:space="preserve"><g><g><path d="M245.5,322.9c53,0,96.2-43.2,96.2-96.2V96.2c0-53-43.2-96.2-96.2-96.2s-96.2,43.2-96.2,96.2v130.5 C149.3,279.8,192.5,322.9,245.5,322.9z M173.8,96.2c0-39.5,32.2-71.7,71.7-71.7s71.7,32.2,71.7,71.7v130.5 c0,39.5-32.2,71.7-71.7,71.7s-71.7-32.2-71.7-71.7V96.2z"></path><path d="M94.4,214.5c-6.8,0-12.3,5.5-12.3,12.3c0,85.9,66.7,156.6,151.1,162.8v76.7h-63.9c-6.8,0-12.3,5.5-12.3,12.3 s5.5,12.3,12.3,12.3h152.3c6.8,0,12.3-5.5,12.3-12.3s-5.5-12.3-12.3-12.3h-63.9v-76.7c84.4-6.3,151.1-76.9,151.1-162.8 c0-6.8-5.5-12.3-12.3-12.3s-12.3,5.5-12.3,12.3c0,76.6-62.3,138.9-138.9,138.9s-138.9-62.3-138.9-138.9 C106.6,220,101.2,214.5,94.4,214.5z"></path></g></g></svg></span></button></div><div class="drag-block" title="按住不放可以拖动"></div><div class="right"><div style="font-size: 0px; position: relative;"><button type="button" title="你有 2 条未读消息" class="bp4-button bp4-minimal bp4-small"><span icon="notifications" aria-hidden="true" class="bp4-icon bp4-icon-notifications"><svg data-icon="notifications" width="14" height="14" viewBox="0 0 16 16" role="img"><path d="M8 16c1.1 0 2-.9 2-2H6c0 1.1.9 2 2 2zm6-5c-.55 0-1-.45-1-1V6c0-2.43-1.73-4.45-4.02-4.9 0-.04.02-.06.02-.1 0-.55-.45-1-1-1S7 .45 7 1c0 .04.02.06.02.1A4.992 4.992 0 003 6v4c0 .55-.45 1-1 1s-1 .45-1 1 .45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1z" fill-rule="evenodd"></path></svg></span></button><div style="position: absolute; background: rgb(243, 1, 1); width: 6px; height: 6px; border-radius: 3px; right: 3px; top: 1px;"></div></div><button type="button" disabled="" title="添加到收藏夹" class="bp4-button bp4-disabled bp4-minimal bp4-small" tabindex="-1"><span icon="star-empty" aria-hidden="true" class="bp4-icon bp4-icon-star-empty"><svg data-icon="star-empty" width="14" height="14" viewBox="0 0 16 16" role="img"><path d="M16 6.11l-5.53-.84L8 0 5.53 5.27 0 6.11l4 4.1L3.06 16 8 13.27 12.94 16 12 10.21l4-4.1zM4.91 13.2l.59-3.62L3 7.02l3.45-.53L8 3.2l1.55 3.29 3.45.53-2.5 2.56.59 3.62L8 11.49 4.91 13.2z" fill-rule="evenodd"></path></svg></span></button><button type="button" class="bp4-button bp4-minimal bp4-small settings" title="快捷设置"><span icon="cog" aria-hidden="true" class="bp4-icon bp4-icon-cog"><svg data-icon="cog" width="14" height="14" viewBox="0 0 16 16" role="img"><path d="M15.19 6.39h-1.85c-.11-.37-.27-.71-.45-1.04l1.36-1.36c.31-.31.31-.82 0-1.13l-1.13-1.13a.803.803 0 00-1.13 0l-1.36 1.36c-.33-.17-.67-.33-1.04-.44V.79c0-.44-.36-.8-.8-.8h-1.6c-.44 0-.8.36-.8.8v1.86c-.39.12-.75.28-1.1.47l-1.3-1.3c-.3-.3-.79-.3-1.09 0L1.82 2.91c-.3.3-.3.79 0 1.09l1.3 1.3c-.2.34-.36.7-.48 1.09H.79c-.44 0-.8.36-.8.8v1.6c0 .44.36.8.8.8h1.85c.11.37.27.71.45 1.04l-1.36 1.36c-.31.31-.31.82 0 1.13l1.13 1.13c.31.31.82.31 1.13 0l1.36-1.36c.33.18.67.33 1.04.44v1.86c0 .44.36.8.8.8h1.6c.44 0 .8-.36.8-.8v-1.86c.39-.12.75-.28 1.1-.47l1.3 1.3c.3.3.79.3 1.09 0l1.09-1.09c.3-.3.3-.79 0-1.09l-1.3-1.3c.19-.35.36-.71.48-1.1h1.85c.44 0 .8-.36.8-.8v-1.6a.816.816 0 00-.81-.79zm-7.2 4.6c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z" fill-rule="evenodd"></path></svg></span></button><button type="button" title="关闭(Esc)" class="bp4-button bp4-minimal bp4-small"><span icon="cross" aria-hidden="true" class="bp4-icon bp4-icon-cross"><svg data-icon="cross" width="18" height="18" viewBox="0 0 16 16" role="img"><path d="M9.41 8l3.29-3.29c.19-.18.3-.43.3-.71a1.003 1.003 0 00-1.71-.71L8 6.59l-3.29-3.3a1.003 1.003 0 00-1.42 1.42L6.59 8 3.3 11.29c-.19.18-.3.43-.3.71a1.003 1.003 0 001.71.71L8 9.41l3.29 3.29c.18.19.43.3.71.3a1.003 1.003 0 00.71-1.71L9.41 8z" fill-rule="evenodd"></path></svg></span></button></div></div><div class="bp4-collapse"><div class="bp4-collapse-body" aria-hidden="true"><div class="bp4-card bp4-elevation-0 quick-settings"><div><span class="bp4-popover-wrapper lang-select"><span aria-haspopup="true" class="bp4-popover-target"><div class=""><button type="button" class="bp4-button bp4-small"><span class="bp4-button-text">自动检测</span><span icon="caret-down" aria-hidden="true" class="bp4-icon bp4-icon-caret-down"><svg data-icon="caret-down" width="16" height="16" viewBox="0 0 16 16" role="img"><path d="M12 6.5c0-.28-.22-.5-.5-.5h-7a.495.495 0 00-.37.83l3.5 4c.09.1.22.17.37.17s.28-.07.37-.17l3.5-4c.08-.09.13-.2.13-.33z" fill-rule="evenodd"></path></svg></span></button></div></span></span><span icon="arrow-right" aria-hidden="true" class="bp4-icon bp4-icon-arrow-right" style="margin: 0px 10px;"><svg data-icon="arrow-right" width="12" height="12" viewBox="0 0 16 16" role="img"><path d="M14.7 7.29l-5-5a.965.965 0 00-.71-.3 1.003 1.003 0 00-.71 1.71l3.29 3.29H1.99c-.55 0-1 .45-1 1s.45 1 1 1h9.59l-3.29 3.29a1.003 1.003 0 001.42 1.42l5-5c.18-.18.29-.43.29-.71s-.12-.52-.3-.7z" fill-rule="evenodd"></path></svg></span><span class="bp4-popover-wrapper lang-select"><span aria-haspopup="true" class="bp4-popover-target"><div class=""><button type="button" class="bp4-button bp4-small"><span class="bp4-button-text">中文(简体)</span><span icon="caret-down" aria-hidden="true" class="bp4-icon bp4-icon-caret-down"><svg data-icon="caret-down" width="16" height="16" viewBox="0 0 16 16" role="img"><path d="M12 6.5c0-.28-.22-.5-.5-.5h-7a.495.495 0 00-.37.83l3.5 4c.09.1.22.17.37.17s.28-.07.37-.17l3.5-4c.08-.09.13-.2.13-.33z" fill-rule="evenodd"></path></svg></span></button></div></span></span></div><div><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>谷歌</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>DeepL</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox" checked=""><span class="bp4-control-indicator"></span>百度</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>百度(专业版)</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>腾讯</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>彩云</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox" checked=""><span class="bp4-control-indicator"></span>阿里</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>阿里(专业版)</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox" checked=""><span class="bp4-control-indicator"></span>有道</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>火山</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>必应词典</label><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>搜狗</label></div><div><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>自动朗读</label><span class="bp4-popover-wrapper"><span aria-haspopup="true" class="bp4-popover-target"><label class="bp4-control bp4-checkbox bp4-disabled bp4-inline"><input disabled="" tabindex="0" type="checkbox"><span class="bp4-control-indicator"></span>自动复制</label></span></span></div><div><label class="bp4-control bp4-radio bp4-inline"><input name="Blueprint4.RadioGroup-0" type="radio" value="small" checked=""><span class="bp4-control-indicator"></span>小</label><label class="bp4-control bp4-radio bp4-inline"><input name="Blueprint4.RadioGroup-0" type="radio" value="middle"><span class="bp4-control-indicator"></span>中</label><label class="bp4-control bp4-radio bp4-inline"><input name="Blueprint4.RadioGroup-0" type="radio" value="large"><span class="bp4-control-indicator"></span>大</label></div><div><label class="bp4-control bp4-checkbox bp4-inline"><input type="checkbox"><span class="bp4-control-indicator"></span>显示文本框</label><label class="bp4-control bp4-checkbox bp4-inline" style="margin-right: 0px;"><input type="checkbox"><span class="bp4-control-indicator"></span>鼠标悬浮取词</label></div><a class="bp4-text-small">打开完整设置</a><a class="bp4-text-small" style="margin-left: 15px;"><span icon="crown" aria-hidden="true" class="bp4-icon bp4-icon-crown" style="position: relative; top: -1px;"><svg data-icon="crown" width="14" height="14" viewBox="0 0 16 16" role="img"><path d="M2 6l3 2 3-4 3 4 3-2-1 6H3L2 6zm6-5a1 1 0 110 2 1 1 0 010-2zM1 3a1 1 0 110 2 1 1 0 010-2zm14 0a1 1 0 110 2 1 1 0 010-2zM3 13h10v2H3v-2z" fill-rule="evenodd"></path></svg></span> 开通会员</a></div></div></div></div><div class="body"><p>请输入需要翻译的文本。</p></div></div><div class="arrow"></div></div><div id="web-trs-panel"></div></div></div></template></div></div></html>